I have come to be responsible for adding push notification capabilities to a phonegap project. Things in iOS are working smoothly but Android is causing some trouble. The problem seems to be that the application package/bundle name is com.phonegap.helloworld. Urbanairship does not like a "duplicate package name", which was easily changed in xcode but not so easily changed in the android side.
I attempted the accepted answer from this question: Change package name to existing Phonegap projects that is, I changed the the 'package' field in the platforms/android/AndroidManifest.xml and then refactored the directory structure to reflect this new package. When I built the android app, however, the old directory that I'd mv'd to reflect the package name change reappeared. The AndroidManifest.xml file had also been altered so that the 'package' field was back to com.phonegap.helloworld.
So I am baffled - how do I change the package name?
You shouldn't edit the files under platforms/ this is where phonegap creates the specific device versions based on the www directory and will overwrite them whenever you run a new build.
To edit the package name, open the config.xml file in the www directory. The package name is the value for 'id' in the 'widget' tag:
<widget
id="PACKAGE NAME"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0"
>
Here's a link to another example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With