Open pdf in .apk with native android application using phonegap -


i coding app ios , android using phonegap (version: 2.7.0). pdf file file:///android_asset/www/test.pdf (compressed in .apk).

i try open pdf native pdf viewer like:

window.open('file:///android_asset/www/test.pdf', '_system', 'location=yes'); 

the command above works on browsers , ios (you have use _blank instead of _system)

i tried load file phonegap file api sdcard, read not possible access files in android_asset/www.

is possible open pdf directly android_asset/www path?
possible copy file sdcard end open there?
maybe possible android install scripts?

edit:

i added .java file in /src/com/...etc .java file:

if (android.os.build.version.sdk_int >= android.os.build.version_codes.jelly_bean) {           super.appview.getsettings().setallowuniversalaccessfromfileurls(true); } 

but there still same problem...

i have output adb -d logcat happens when start app , click pdf link:

i/activitymanager(22040): displayed com.company.appname/.appname: +1s611ms i/activitymanager(22040): displayed com.tf.thinkdroid.samsung/com.tf.thinkdroid.pdf.app.pdfrenderscreen: +1s549ms d/cordovalog(27549): exception firing pause event native i/web console(27549): exception firing pause event native @ undefined:1 ... i/inputreader(22040): dispatchtouch::touch event's action 0 i/inputdispatcher(22040): delivering touch current input target: action: 0, channel '40a9f450 com.tf.thinkdroid.samsung/com.tf.thinkdroid.pdf.app.pdfrenderscreen (server)' i/inputreader(22040): dispatchtouch::touch event's action 1 i/inputdispatcher(22040): delivering touch current input target: action: 1, channel '40a9f450 com.tf.thinkdroid.samsung/com.tf.thinkdroid.pdf.app.pdfrenderscreen (server)' .... d/droidgap(27549): resuming app

i believe might work in case:

 if (build.version.sdk_int >= version_codes.jelly_bean) {   webview.getsettings().setallowuniversalaccessfromfileurls(true); } 

originally answered here: allow opening of local files in html5 phonegapped android app


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -