Issue
Really weird issue. I have an application. This app opens a web page and allows user to fill form data and extract data when results page shown. Everything works fine until I add android:targetSdkVersion="17"
to uses-sdk
section. JavascriptInterface doesn't work if this line added in AndroidManifest.xml
Works with this-> < uses-sdk android:minSdkVersion="10" />
Doesn't work with this-> < uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17"/>
Does anyone experienced same or similar issues like this? Is there any problem with not setting targetSdkVersion in Manifest?
Solution
Does anyone experienced same or similar issues like this?
Yes. It is even covered in the documentation for addJavascriptInterface()
:
For applications targeted to API level JELLY_BEAN_MR1 and above, only public methods that are annotated with JavascriptInterface can be accessed from JavaScript. For applications targeted to API level JELLY_BEAN or below, all public methods (including the inherited ones) can be accessed...
Simply set your build target (e.g., Project > Properties > Android in Eclipse) to API Level 17+, and add @JavascriptInterface
to the methods you want Javascript code to be able to access.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.