Having an issue, hoping someone can point me in the right direction.
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.
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
@Ken
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
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
No, I have a bunch of apps.
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
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
@Ken
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
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
These are older apps, I would rather not upgrade them above 3.7 unless I need to, and at this point I do not even know what the problem is and why apps that have been working for years suddenly stopped working as of a week or two ago.
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.
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
If the app sends the request, the server receives the request and replies, and then the client receives an 'empty return set', it has probably nothing to do with:
- 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).
- 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).
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Depends on what the response looks like. Is it a string, a json object, XML?
- 10 Posts
- 0 Reply Likes
Just text, but starting to think it is not the same problem I was experiencing with the ajax stuff. I set up some logs on the server and my file transfer is not even getting to the server, so its dying at the app. Any changes in the new chromium webview that would impact phonegap file transfer?
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
No, I would rather expect this to be either a coding problem (do you get any javascript error messages? Is the ajax function reached and executed at all?) or a whitelist problem.
- 10 Posts
- 0 Reply Likes
It doesnt use ajax, it uses the built in phonegap file transfer plugin, which I assume just mimics a normal html file transfer. It works on all browsers including the older androids, just breaks on the new chrome. Working on setting up some debugging now to see about javascript errors.
- 10 Posts
- 0 Reply Likes
@Petra V. I tracked the source of the issue to my select picture function, where I use window.resolveLocalFileSystemURL() to convert the URI to a file path. It does not error, but it spits out the exact same URI as I give it, where on my older android (4.0) and phonegap it converts it to a proper file:// path rather than content://
- 10 Posts
- 0 Reply Likes
Hi, thanks Petra V for the feedback.
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?
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
You don't need jsonp. You can return any string. There will be no CORS issues.
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
@Ken,
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:
Details
Let us know what you need next.
Jesse
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
@Ken,
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
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


