I have a few different older Apps, all built with phonegap build, 3.7, works in iOS and android. They work great, and have been working great in some cases for years. A couple weeks ago someone bought a new phone and was having issues, and then other folks started reporting problems. In all cases it is folks that have Android 5.0+ OS. Everything works still for everyone else and in some cases it was working for them with android 5.0 and then later broke.
After poking around a bunch I have found the cause to be my ajax communication. It sends the appropriate information to my server (the different apps use different servers btw, so its not server specific) and the server does what it should do, however the information sent to the success/error functions is empty.
Any suggestions as to what might be new with Andriod 5 that is causing this issue, maybe something with cross domain? I do not use cookies, it is using jsonp, and I have the whitelist and other 'allow' settings in my config file, and it has been working for years in some cases.
- 10 Posts
- 0 Reply Likes
Posted 4 years ago
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
Since this is your first post, please answer the following question.
- Is this your first hybrid App?
- Are you using the Phonegap Desktop App?
- What is your target device/platform and their target versions: Android 4,5,6? iOS 7,8,9?
- Are you using CLI, SDK or Build? Please do not assume the answer, please read the link.
Thanks
Jesse
- 10 Posts
- 0 Reply Likes
Yes, I used the Desktop software and apps to help with speedy testing
Apps are not complex, was android and iOS, this is the first time I have had it not work in another version.
I use Build, my apps are built on version 3.7 which I think means its not impacted by the most recent white list changes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
A lot has changed since 3.7, you will need to add the whitelist plugin (see below).
About *Phonegap Desktop App*:
It is not intended for development. It is not intended to produce a final product.
You should remove it from your workflow. Use your webbrowser or an emulator to validate your UI. *Phonegap Desktop App* REQUIRES *Phonegap Developer App* - So you can never use it in the final product.
This is such an annoying item. I am going to blog in a few days. A member of the PGB team is helping me - so I don't get it wrong.
This FAQ should help. Read the bold sentences first.
Top Mistakes by Developers new to Cordova/Phonegap
ON THE WHITELIST
This whitelist worksheet should help.
HOW TO apply the Cordova/Phonegap whitelist system
If you can't get the configuration right, come back I have solutions. But at this point, you got a lot of reading to do.
Jesse
- 10 Posts
- 0 Reply Likes
From what I read if I leave them at 3.7 I do not need to worry about the white list changes?
I am not sure what phonegap desktop app has to do with anything, specially my problem, I use to edit my stylesheets and layout, how that limits my final product is beyond me.
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
- the PGB version
- the whitelisting (and indeed, no whitelisting plugin is necessary in 3.7.0)
- the number of apps you have built so far
One new Chromium Webview was introduced in KitKat (4.4.4, webview Chromium v33). Your issues might very well occur in KitKat, too (but were only reported by Android 5 users, so it only looks like it's an Android 5 issue).
As of Android 5, the new Webview (v36) has moved to an APK. The Webview is automatically updated on devices, so the issue may well have started with an auto-update of the webview on your users' phones.
My guess is that your server response is not (always) what is expected by the new Chromium V33 or V36 with their new version of Javascript engine V8. I am not sure what that could be (perhaps an http header). However, it might be worth looking at exactly what it is the server returns, and what exactly arrives in the app. I don't rule out that the proper return values arrive in the app, but the javascript interpretation fails, so it only looks like the return values are empty.
You may want to test this by:
- creating a tiny web service, only returning a fixed string like "I have finished"
- requesting information using Ajax from this web service
- checking the returned string in the app.
No json(p), no ssl, no special headers, no redirecting, no nothing. Just this one string exchange. This will allow you to see if the most basic communication works correctly. If so, you can look for differences with your jsonp user case.
Just a heads up:
from the second half of May 2016, Google will not accept any apps or app updates created with PGB3.x anymore. This means that you will probably have to upgrade to PGB cli-5.x or even PGB cli-6.x anyway
(which will not solve the issue in this thread, I believe).
- 10 Posts
- 0 Reply Likes
In the end it was a content type error, with jsonp it needs to be application/javascript, while I had it as application/json. Older browsers never cared apparently, but suddenly the new chromium webview did care and was creating an unparseable object in return.
Thanks again, appreciate the help.
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
Yes. That is annoying.
Wikipedia: JSON#MIME_type
If you have a version, I'll be happy to add that to wikipedia.
Jess
- 10 Posts
- 0 Reply Likes
I was a bit hasty in my thinking that everything was fixed. All of my ajax communications with the server are now working great. However, one of my apps takes a picture and uploads it to the server via phonegap's file transfer plugin. Works great in everything, other than a new android again. I assumed it is a similar issue and tried various content-type header declarations (text/plain, text/html, etc) but without any luck. Thoughts?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Depending on what it is, it could be image/png, image/gif, etc.
- 10 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
- 10 Posts
- 0 Reply Likes
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
- 10 Posts
- 0 Reply Likes
- 10 Posts
- 0 Reply Likes
- 10 Posts
- 0 Reply Likes
It was my understanding that I need to use jsonp because of the cross domain nature of app -> server. Seems like I should do the simple test using jsonp or it will fail anyways?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
you will be required to move away from Phonegap 3.x
Here is what you need to know.
Google recently sent out an alert stating, in short:
Beginning May 9, 2016, Google Play will block publishing of any new apps or updates that use pre-4.1.1 versions of Apache Cordova.
Details
Let us know what you need next.
Jesse
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
I am not sure what phonegap desktop app has to do with anything, specially my problem, I use to edit my stylesheets and layout, how that limits my final product is beyond me.
If you are using PDA to validate your layout, you can do the same with an emulator _or_ a webbrowser in emulation mode (all modern browser have responsive mode.) However, I can't twist your arm I can only make a strong recommendation that you leave PDA.
Of note, there are over 2000 Android devices. You'd be living a fantasy to think your device(s) have any advantage when doing your design work.
http://opensignal.com/reports/2014/android-fragmentation/
Best of Luck
Jesse
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers


