android - Make javascript injection compatible for api 16 -


i building android app have compatible api 14 , newer. have 1 method inside javascript interface.

from api 17 have add annotation method, @javascriptinterface, annotation not supported backwards api, since app target api 14 got error. if dont add annotation, javascript not trigged in mobile android 4.2.

is possible make kind of ifdef if deviceos newer 4.2?

set build target api level 17. set android:minsdkversion old of android want support. code compile and have @javascriptinterface annotation. lint point out places in code use classes, methods, etc. newer android:minsdkversion, can make sure doing correctly.

or, set android:targetsdkversion 16 or lower, in case @javascriptinterface not required. see http://developer.android.com/guide/webapps/webview.html#bindingjavascript.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -