[PhoneGap Build] PhoneGap 2.7.0 now available

  • 1
  • Announcement
  • Updated 7 years ago
Upgrade your apps!

For more info, check out the blog post:
https://build.phonegap.com/blog/phone...
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes

Posted 7 years ago

  • 1
Photo of Yair Cohen

Yair Cohen

  • 2 Posts
  • 0 Reply Likes
Ios build last forever more than a hour
I would like to upgrade, but the BarcodeScanner Plugin hasn't been updated to make use of the new CordovaPlugin.java instead of the deprecated Plugin.java, and therefore doesn't work with PhoneGap 2.7.0. I tried to fix it simply changing the references but it seems it wasn't enough... I will delve deeper into the code, but I'm sure an expert could fix this much faster than me.
Photo of Khatib Yahya

Khatib Yahya

  • 4 Posts
  • 0 Reply Likes
Hi i need someone to make me a astrology programme for mobile phones my email khatibuz2008@gmail.com i will be glad for your assistance
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
Have you tried PhoneGap 2.7.0 w/ BarcodeScanner on PhoneGap Build? Works.
You are completely correct, it works on PhoneGap Build. Will you be updating the code on your GitHub repo? I like to build my own Android versions for development and only use PhoneGap Build for testing on other devices.

Thanks by the way!
Photo of Khatib Yahya

Khatib Yahya

  • 4 Posts
  • 0 Reply Likes
Hi i need someone to make me a astrology programme for mobile phones my email khatibuz2008@gmail.com i will be glad for your assistance
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
We actually re-added the shim which was removed in 2.7, rather than updating the plugins, since we need to be able to support several older versions of PhoneGap. You should be able to do the same in your local version as well. See https://github.com/apache/cordova-and...

I will try to update the BarcodeScanner as soon as I can -- or maybe some android master from the community will beat me to it with a pull request ...
Would the patch have to include backward support for PhoneGap < 2.7 or simply work with the new CordovaPlugin class?

I might be interested in updating the plugin since I was also looking into tuning the encoder to return an image instead of creating a new activity (is this possible?). At the moment I am using a JS QR encoder library to insert the QR codes on screen and I feel that if I could use the PhoneGap encoder directly it should be leaner, but I need just the image inserted into my DOM, not a new activity.
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
Well in general PhoneGap plugins don't need to be backwards compatible -- user's can simply use older tags of the plugin if they want to use an older version of PhoneGap. But on build plugins need to be backwards compatible since we support (at least a few) older versions of PhoneGap. We're still working out what the best approach to this is, which is why we opted to patch PhoneGap for now rather than upgrading the plugin.
Photo of Khatib Yahya

Khatib Yahya

  • 4 Posts
  • 0 Reply Likes
Hi i need someone to make me a astrology programme for mobile phones my email khatibuz2008@gmail.com i will be glad for your assistance
Photo of Bob Johnson

Bob Johnson

  • 34 Posts
  • 1 Reply Like
I'm having a very basic, basic issue with 2.7.0. Something as simple as my back buttons (data-rel='back') are not working. Instead, my app just crashes.

Am I the only one? I immediately went back to 2.5.0 and everything is perfect again.
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
What device are you testing on? Are you seeing any javascript exceptions?
Photo of Bob Johnson

Bob Johnson

  • 34 Posts
  • 1 Reply Like
iPhone 4, iPhone 5, LG Optimus V, and Samsung Gal S3. I'm not seeing any logs when it dies, other than just telling me that it died.
Photo of Khatib Yahya

Khatib Yahya

  • 4 Posts
  • 0 Reply Likes
Hi i need someone to make me a astrology programme for mobile phones my email khatibuz2008@gmail.com i will be glad for your assistance
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
Photo of naumaan khan

naumaan khan

  • 2 Posts
  • 0 Reply Likes
The phonegap build has some how stopped supporting the barcode plugin since yesterday. 3 days ago we made a build from phonegap build it worked fine and now it dosent please help
Photo of ryan

ryan, Developer

  • 1538 Posts
  • 132 Reply Likes
Photo of Marcel Syriani

Marcel Syriani

  • 2 Posts
  • 0 Reply Likes
Samsung Galaxy S3 camera crash with PhoneGap 2.7.0 and before we had our App on PhoneGap 1.8.1 with no issues with Samsung S3 and Note whenever we take a picture with the Camera we were able to save the image. Now we can not build with 1.8.1 anymore, so why 2.0 and higher is causing issues to S3 and Note camera to crash. There is a change between 1.8.1 to 2.x to cause this issue. Please could you help on this.
Photo of Alan Neveu

Alan Neveu, Champion

  • 213 Posts
  • 11 Reply Likes
Okay, we tried upgrading from 2.5 to 2.7 and we find the following problems in 2.7:

. On iOS something goes drastically wrong and javascript code is not running, I believe in the onDeviceReady. I will do some debugging to try to determine where the breakdown is happening, but I want to get this question out there sooner rather than later.

. On Android 2.3.X and 4.X we find things generally work, but when we call navigator.camera.getPicture and the user takes a photo, something crashes either before our success handler is called or in our success handler code. Again, I will do some debugging to determine where the breakdown is, but I wanted to ask this question sooner rather than later.

So the basic question here is, What are the required changes for upgrading from PhoneGap 2.5 to 2.7? I see the issue about needing to put an empty file called cordova_plugins.json in the root, tried that and it did not help. I also see some new functionality in 2.6 and 2.7 regarding things like InAppBrowser. Sounds great, but is there some default value that needs to go into config.xml when upgrading from 2.5 to 2.7?

In the future, how about if PhoneGapBuild took the initiative of testing the upgrade path of a few basic sample apps, and documented what the users of PhoneGapBuild need to do in order to upgrade from one version of PhoneGap to another? I see this as a recurring theme - every time a new version of PhoneGap is supported by PGBuild, those of us who actually use PGBuild for our development have to go tracing down these kinds of issues and communicating about them using forums and such. Sure, I see the change logs in GitHub and other places, but that does not help us much. Not trying to be a prick here, just asking for more help for the upgrade path so that we can stay current with all the awesome bug fixes that are available to us in PhoneGap itself. As it is, it seems that we have to jump through a ton of hoops just trying to get up to the latest version, so that we can then re-test our apps to make sure that the latest PhoneGap doesn't break things. This is very difficult.
Photo of Alan Neveu

Alan Neveu, Champion

  • 213 Posts
  • 11 Reply Likes
Update... The iOS problem I described earlier turns out to be due to a timing issue. We use something called Stratified JavaScript from onilabs.com to make our html5/js app actually maintainable and productive - this library makes asynchronous javascript functions as easy to call as synchronous functions, without blocking the browser. It's fantastic, if you are interested. But it is not without some issues, such as this one. With PhoneGap 2.7, we are finding that the onDeviceReady function is being called earlier than with 2.5, and StratifiedJS has not yet finished working its magic on our inline javascript. When this happens we get an error like so:

ReferenceError: Can't find variable: myStartupFunction

Which is essentially saying that my function is missing, and it seems that at this moment StratifiedJS is not finished wiring it up. If we wrap the call to our function in a setTimeout with 100ms delay, all goes well 100% of the time. Without the setTimeout, it fails 75% of the time and works 25% of the time. I have posted to the Google group for StratifiedJS to see if they can help us with an event that will fire when their library has finished preparing the inline javascript. That seems like it would be the proper solution, rather than some arbitrary number of milliseconds to wait, which could fail depending on the device.

Okay, now on to investigate this Android camera issue...
Photo of Alan Neveu

Alan Neveu, Champion

  • 213 Posts
  • 11 Reply Likes
And here is the result of my debugging the Android getPicture issue... We have been using FileURI instead of DataURL for our getPicture calls on Android. To make a long story short, we have been doing this because many folks on the PhoneGap forums told us that using DataURL will crash the app because it loads the image bytes into memory, cameras on phones take such large photos these days, etc. But we have to load the image into memory so that we can shrink it to a reasonable size such as 1024 x 768 or 1280 x 960 before loading it to our web servers. Then people tell me to not do this and use a file upload command instead. Brilliant, send the full 8 MB instead of 30 KB to the web server and make the user sit around and wait, just so we can avoid loading the bytes into memory?? Can we just say it that if Android can't handle this it sucks and we are not talking about a bad design idea but rather an OS that is loaded with bugs in memory management?? Okay, enough of that, thanks for listening.

Sooooo, lo and behold, we switch to using DataURL and PhoneGap 2.7 works just fine when we call getPicture. More debugging shows that when using FileURI and we attempt to read the .jpg file that is returned in the data parameter, we can't get at the file and we just get back null. Beautiful. Works great in PhoneGap 2.5, fails in 2.7. Love that! So we are going to consider switching to DataURL, even against the advice of so many Android lovers that told us our design is flawed. I have a hunch that the many user complaints of sporadic camera failures on Android have been due to using FileURI in the first place. We shall see. At this point we don't have any choice because we are not able to read the file using FileURI.

Any comments are welcome!
Photo of Alan Neveu

Alan Neveu, Champion

  • 213 Posts
  • 11 Reply Likes
Okay, and I take back my somewhat harsh words about upgrading to a new PhoneGap version within PhoneGapBuild. Both of these issues had nothing to do with PhoneGapBuild, but rather are due to some changes within PhoneGap itself. The iOS issue is probably isolated to folks like us who have to do tricky initialization tasks with re-wiring of inline javascript. But the Android camera issue is probably something that others will face when they upgrade. At least those who are using FileURI...
Photo of Mario

Mario, Champion

  • 120 Posts
  • 17 Reply Likes
As a comment to PhoneGap Build with PhoneGap 2.7 + photo upload:

I use FILE_URI and I also need the images to be scaled down for fast uploads. To scale down I simply set targetWidth and targetHeight. Works on iOS and Android.

To upload the image on Android, you need to call window.resolveLocalFileSystemURI to get the path to the file, otherwise you will get a null file. Reason: Android can not handle the content:// URI of the image.

Hope this may help someone. I had to invest a lot of time to get things done, in this case. Now, it's fun again. :-)
Photo of Alan Neveu

Alan Neveu, Champion

  • 213 Posts
  • 11 Reply Likes
Ah, you are correct, my memory was hazy... Yes, when we use FileURI we are also setting targetWidth and targetHeight. I recall now.. The problem is that we need to show a thumbnail of the selected photo, and the way we are doing it is to get the base64 string of the bytes and use that in the src attribute of an img tag. That works just fine, but people were saying it would crash Android. Oh, also, there was a big discussion we had with those folks about how to upload the image to our servers. We use a custom web service that accepts chunks of base64 encoded bytes, which gives us the ability to show a nice progress bar and adjust the chunk size according to network performance (smaller chunks on slower networks so the user is confident the process is not locked up). And those folks said we were nuts and should use a file upload only because loading the base64 string from the image bytes would crash. Well, it does not crash and it turns out using DataURL is just fine. And in this case using FileURI no longer works for us after upgrading to PhoneGap 2.7. Our code also uses resolveLocalFileSystemURI, but when we try to do the reader.readAsDataURL, we get back null.

So, we are testing out the switch to DataURL. I'll let y'all know if this works out for us, just in case there is someone else who comes along and has a similar problem with PhoneGap 2.7 or higher.
Photo of Mario

Mario, Champion

  • 120 Posts
  • 17 Reply Likes
You can show a thumbnail when using FileURI. Just set the src to the imageURI.
I think/hope it works both ways. Anyway, good luck!