This appears to be an Android+Cordova issue, which is not something we can fix for you. These threads are particularly useful:
The changes being suggested are to the AndroidManifest.xml file, not to your config.xml file. To implement such changes into the AndroidManifest.xml file you need to use some special PhoneGap Build-specific notation withing your config.xml file, as outlined by this PhoneGap Build doc page > http://docs.phonegap.com/phonegap-build/configuring/config-file-element/ < (note this requires adding an additional namespace fragment -- xmlns:android="http://schemas.android.com/apk/res/android" -- to the <widget> tag in the config.xml file to avoid errors with PhoneGap Build).
thank you now I'm trying your suggestion. I will update if it works. But...everything I'm changing manually, will be automatically put into config.xml by next XDK release? (in example density for icons, in example this adding made for the LaunchMode and namespace and so on...). I'm trying to figure out that I will put this into config.additions and they will be put into config.xml file ready to be exported, is it? tell me yes please
We are fixing the density issue and I've requested that the additional namespace be added to the <widget> tag, as well as several other fixes that are needed for proper operation of the export feature. In addition, I have an external script you can use that I'm currently updating, in order to address changes that do may be delayed in the product.
Regarding the specific instructions you are adding to change the LaunchMode, that is something that is specific to your application, so having us add those tags does not make sense for all users. However, you can put those lines into the intelxdk.config.additions.xml file and they will be transferred, untouched, to the exported config.xml. Other than a few items specific to Crosswalk, everything that is in your intelxdk.config.additions.xml file is transferred without change into the exported config.xml (do a compare and you'll see what I mean).
I've used apktool to see difference between standard XDK build apk and standard (no modifications) PhoneGap build apk. In particular I've seen difference in manifest.xml file
1) XDK builds with launchmode = "singleTop"
2) Phonegap builds without launchmode option (so standard is assumed)
So the problem is not only mine, but for everyone, because the behaviour of the app changes.
Anyway the problem is in example when I call custom url scheme to open app and pass to it parameters. Everytime a new instance is open and is pushed on history stack, so going back and back you fill find the original app opened. This is catastrofic because I handle back and push states
hello I fixed it by adding namespace to widget tag (as You suggested) and by adding
<config-file platform="android" parent="/manifest/application" mode="merge"> <activity android:launchMode="singleTop" /> </config-file>
to the config.xml of exported zip.
but anyway adding it in config.additions.xml is not exported correctly:(
infact the snippet is not transferred to config.xml if declared outside android platform tag in config.additions.xml; if I declare it into android platform is transferred without activity tag (the most important thing to transfer). But PhoneGap needs it OUTSIDE the platform tag.
You're correct, it's not getting transferred from the additions file to the config file. I'm just finishing a Node.js script that will work with that situation. I believe it is not getting transferred by the export option because they are using a full XML parser to process the contents, whereas my script is simply doing an AWK-like transformation of the files. There's a draft version of the script I am referring to here > https://github.com/xmnboy/xdk-to-cli < but it won't work the way you want it to until I get the 3.0 version posted, which I'm trying to finish this week. At that point the instructions will change dramatically on that README, so you'll know when it is ready to try.
ok, anyway I think you should add for everyone the snippet here, because it lets PhoneGap build to work as XDK build
<config-file platform="android" parent="/manifest/application" mode="merge"> <activity android:launchMode="singleTop" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" /> </config-file>
and of course namespace in widget tag. This update fixes SingleTop launch mode and the title bar at starting that I posted here https://software.intel.com/en-us/comment/1900335#comment-1900335
What you think about it?
Alessandro, try adding this preference tag to your intelxdk.config.additions.xml file, it should not be removed and should do what you want:
<preference name="AndroidLaunchMode" value="singleTop"/>
See these cordova config.xml docs > https://cordova.apache.org/docs/en/latest/config_ref/index.html < and this sample additions.xml file > https://github.com/gomobile/sample-hello-cordova/blob/master/intelxdk.config.additions.xml <
I've confirmed what you've found. It appears that PhoneGap Build is stripping or ignoring that standard Cordova CLI preference tag. I built with a local copy of CLI to confirm, and it behaves as expected. I'm asking Adobe why this is the case and will see if this is something we can get into the upcoming hotfix, but I am not able to promise it will be part of that fix, we're trying to address several very pressing issues ASAP.