- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I got 404 (Not Found) when run my app on android phone for those ajax url or media src. (ps: find it out when using debug tab and 404 show on console) Already added
<meta http-equiv="Content-Security-Policy" content="media-src 'self' https://xxx.mooee.com; connect-src 'self' https://xxx.mooee.com; ">
to index.html
but still fail and got 404 when run on android phone. It is ok when run on iPhone or desktop browser.
URL used in ajax like this: https://xxx.mooee.com/yyy/test/p02Launcher.php
URL used in video source src like this: https://xxx.mooee.com/yyy/test/a.mp4
Anything wrong?
P.S.
I'm using XDK ver 3240 and there is no different for using build tab. Also, the cert our server use is not a self signed cert. I just replace the real subdomain with xxx here.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you added your URLs in Network whitelist? The CSP meta tag will only work on Android 4.4+. Please see this article for whitelisting URLs: https://software.intel.com/en-us/articles/cordova-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using jQuery, please also read this FAQ > https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think it is not related to whitelist issue as the console not saying 'blocked' for the url access. In fact, I got the 'blocked' in console before added the meta tag (<meta http-equiv="Content-Security-Policy" content="media-src 'self' https://xxx.mooee.com; connect-src 'self' https://xxx.mooee.com; ">) So it is another issue. Besides, the video tag in my app got 404 too.
<video controls="controls" id="p03-vdo-ChildPerf" preload="default">
<source src="https://xxx.mooee.com/yyy/test/a.mp4" type="video/mp4">
</video>
So it is not just related to ajax.
p.s.
there is no different for adding "https://xxx.mooee.com/*" to <access> and <allow-intent> in android build setting of my project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you adding it to your CSP tag in your index.html file? http://www.html5rocks.com/en/tutorials/security/content-security-policy/ explains CSP and https://software.intel.com/en-us/articles/cordova-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps contains some example CSP meta tags that you can experiment with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Already added CSP like this in index.html:
<meta http-equiv="Content-Security-Policy" content="media-src 'self' https://xxx.mooee.com; connect-src 'self' https://xxx.mooee.com; ">
and <access> and <allow-intent> in project android build settings set to https://xxx.mooee.com/*
as I said in this post
Anything wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you check this faq?
If you are using jQuery, please also read this FAQ > https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think even though I can solve the problem on ajax. Still has video src issue. As we need to do streaming, so it is not workable for us to use ajax to get the video src and save at client then play it. That's why I'm not start to follow all advice for ajax on this post yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arthur, are you building with Crosswalk or just Android? Which Cordova version are you using? What min and Target API are you specifying? Assuming you have done everything right for AJAX request, check few things :
1) Server certificate : Android is sensitive about the certificate order, so please make sure your server certificate chain is correct
2) Permissions on your Android device
3) Try with Unsigned app
4) try to run your ajax request and/or video request using mobile browser on your Android device and see if that works
5) In the video tag do not use type attribute.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for all of you. Now it works on android and iOS devices. May be last time I used a wrong AppID in android project settings. (but don't know why it can build using the keystore)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arthur -- Android certs do not require a match with the App ID like iOS certs do. Any App ID will work with any Android cert. On Android, the primary purpose of the cert is to confirm that any updates to an app are coming from the original owner of that app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your information. When I build for android. I chose 'shared' for crosswalk runtime. And there are 2 apk, one for arm and one for x86 after download the build. I think I can install any one of them to my LG nexus 4 as both ok to install. I only need to choose the one for arm when I chose to embed crosswalk runtime in my project, right?
fyi: seems the problem happen on debug tab only as the app is ok when I chose to build my app with embed crosswalk runtime ver 16. If I chose ver 17, debug tab ok too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arthur -- yes, when you build for shared the system generates to APK files, labeled ARM and x86. In fact, those two "shared model" APK files are identical. It's a weird artifact of the new build system that does that. We haven't had time to fix it. You only need to submit one of those to the store, but if you submit both, it will still work fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your information. That's ok for the "shared model" still have 2 APK when build with XDK 3357 as long as I know they are the same.
P.S. Maybe that is cause:
I change an old project's name to a new one. The old project was created by XDK 3240 and it was built before. After changed the project name (I changed those in ~/Library/Application Support/XDK/global-settings.xdk and state.json too under XDK not running)
Then after I build the project by 3357 and download the build. The filename still suffix by the old project name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arthur -- I think that project name on the APK files that you download comes from the project folder name or the <project-name>.xdk file in the project folder. I'm not sure and have never experimented to figure that out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FYI: Seems that is not the reason as I changed xdk too. I tried delete uploaded project source files from build server before build. But the build filename still suffix by the old project name.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page