3 ms·
I'm not quite sure I understand what you mean (so if this is the wrong answer let us know). But if you mean why do we use a different method on Android compared
by Connorhd 15y ago
I'm not quite sure I understand what you mean (so if this is the wrong answer let us know). But if you mean why do we use a different method on Android compared to iOS: we can communicate directly from Javascript to Java as part of the WebView in Android, which is very fast. The URL interception method is actually the slowest part of iOS but there is no way around it.
- ynniv 15y agoYou can call Objective-C from JavaScript on iOS: [ https://developer.apple.com/library/mac/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html https://developer.apple.com/library/mac/#documentation/Apple... ]
- Connorhd 15y agoI believe this is a Mac OS X feature that isn't supported on iOS.
- deleted 15y ago[deleted]
- theoj 15y agoThanks for the answer. Sorry I wasn't clear... I was referring to this part of the article, in which you describe how the HTML / JavaScript communicates with Objective C on the iPhone: >> We then make a request to a fake URI (forge://…) which we intercept in native code Have you tried doing the same for Android? Do you have any numbers that compare the performance of this method with the JS -> Java bridge?
- Connorhd 15y agoOk, that makes sense, the JS -> Java communication in Android is already very fast as it is something that can be done as part of the WebView. The fake URI request is a workaround on iOS as this feature doesn't exist. I don't have any numbers offhand, but the JS -> Java communication is definitely a very quick part of the bridge.