- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my App I transfer file and picture from my database on external server a save them locally on smartphone with FileTransfer Plugin. Then to view the downloaded file I use InAppBrowser plugin (V. 0.5.4). This is my code:
if (intel.xdk.device.platform == 'Android' || intel.xdk.device.platform == 'android')
var path = strUrl;
window.open(path, '_system', 'location=no');
}
else {
var url = strUrl;
window.open(url, '_blank', 'location=no');
}
Everything worked well and, for example, I can view a pdf file with default reader on device then i can close them and return to my app.
suddenly while all running fine on ios, on Android devices can no longer go back to my app. In fact there is no button "done" or no way to close the viewer pdf or jpg, for example, and return to my app. If I click the back button on device the application will also close my app and I must log again.
Is use InAppbrowser because it is the only way to view pdf files with the player by default on Android devices. So i don't know why that plugin suddendly show that problem.
Any help and advice is appreciated
Thanks
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you targeting a specific version of the plugin? If you are not, and the author of the plugin changed something recently and published a new version, your build will be using the newest version unless you target a specific version when you add the plugin to your project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use the standard version of Intel XDK i.e 0.5.4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That plugin has not changed in quite some time.
Did you update your device recently?
What happens if you include the pdf in your app and launch it locally with the inAppBrowser? Does it render correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
no recent changes...
as I said in my first post i download file pdf correctly and my app lauch it with inAppBrowser and render it correctly..This in not the problem..the problem is I can't close pdfviewer and I can't back to my app..if I touch back button of device it close the viewer and also the app...
in IOS all is ok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using Android's native webview or are you using Crosswalk (did you choose Crosswalk for Android in your build settings)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use target as '_blank' for Android as well.
window.open(url, '_blank', 'location=no');
In your code you are using '_system'. When you use '_system', the app opens an instance of system browser and the control gets transferred to the browser instance. When you use '_blank', an inAppBrowser instance gets created within your app and the back button is displayed as part of that instance and pressing back button brings the control back to the app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use _system because is the only way i can view pdf file.....if i use _blank I can't view them on android...
with _system a time ago it was all ok!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i use Android not Crosswalk for Android in my builds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
InAppBrowser plugin does not support pdf viewing on Android. The system browser does, but then as I said it will not give control back to your app. Since you are downloading the pdf on your device, I would recommend you use a file opener plugin to view the pdf.
https://github.com/don/FileOpener (Android only) or
https://github.com/pwlin/cordova-plugin-file-opener2 (Android and iOS)
Another option is, if your file is served from your own server then you can set up pdf.js library (https://mozilla.github.io/pdf.js/) on your server and directly point inAppBrowser to the pdf.js location with your pdf filename.
window.open('http://YOUR_DOMAIN/pdfjs/web/viewer.html?file=YOUR_PDF_URL', '_blank', 'location=no');
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your explanation very useful ...i already tried with fileopener but i can't open file...i try with pfd.js....but in any case I do not understand why using the following code for a while everything was working fine on Android
if (intel.xdk.device.platform == 'Android' || intel.xdk.device.platform == 'android')
var path = strUrl;
window.open(path, '_system', 'location=no');
}
else {
var url = strUrl;
window.open(url, '_blank', 'location=no');
}
thanks so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i try with my app's release of may 2015 and all work very well...but with release of now not...maybe new version of xdk has some problem...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have seen back button work on some devices when you use '_system' but may not work on all devices. If you are using the same device and if it worked for you earlier, check these few things.
1) You are missing opening curly bracket '{' for your if statement in the code snippet you provided. Correct that, if that's in your actual code.
2) In your code you are usig Intel XDK device plugin to check for Android platform, make sure you check the Intel XDK device plugin checkbox on the right side of plugins section
3) Make sure you have set the whitelisting in Projects > Build Settings properly. Put * in the Access List box and select internal whitelist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
on same device old release work ..newest not!
if i miss some bracket when i launch emulator it must to check it!
I have check device plugin
I put * in the Access List box and select internal whitelist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I find the problem:
my app use nfc plugin too and I need to modify Android Manifest to add an intent to open my app where read nfc tag.
I Use this code:
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="com.sicursell.wwsrsicursell" version="1.0.0">
<name>Intent NFC</name>
<description>Modify AndroidManifest.xml</description>
<license>MIT</license>
<keywords>android, WebIntent, Intent, Activity, NFC</keywords>
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<!-- android -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:label="@string/app_name" android:name="CordovaApp" android:noHistory="true" >
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</config-file>
</platform>
</plugin>
if I delete android:noHistory="true" all work well and I can view file (image or pdf) then return to my app without problem
Thanks to all

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page