Change Widget ID or Package Name for android/iOS platform on phonegap?

孤街浪徒 提交于 2020-02-19 09:56:38

问题


I have an app in Google Play with package com.example001.androidand one app in the iOS store with the name com.example001.ios.

However, I am now using the phonegap build, have removed a lot of the bootstrap code, leaving only the www folder, I am using the widget id from config.xml, so now I only have 1 config.xml.

If I set the widget id to com.example001.ios I can't publish this app in android. If I leave the widget id to com.example001.android I can't publish this app in apple store.

If I change the widget ID to a generic one, say com.example001.mobile, then I won't be able to upload the app to Google Play because the package name changes.

How do I set the package name/ID for each target platform?


回答1:


Try this:

<widget id="com.company.app" android-packageName="com.company.androidapp" ios-CFBundleIdentifier="com.company.iosapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

P.S. android-packageName & ios-CFBundleIdentifier property are not properly documented but its works tested on latest(4.1.2) cordova.




回答2:


I would create two projects and have them share a www folder.

Here is an example for local CLI builds:

/MyProject_base
  /iOS
    /www -> /MyProject_base/www
  /Android
    /www -> /MyProject_base/www
  /www

The iOS and Android folders will each have a separate full project in them with the www as a symlink to the base www.

This way you can customize each project in regards to settings and keep one www folder between the two.

Here is an example for PGBuild:

/MyProject_base
  /iOS
     /www -> /MyProject_base/www
     /config.xml
  /Android
     /www -> /MyProject_base/www
     /config.xml
  /www

Create two separate config.xml use one www folder. You will have to upload each version separate and it will be two separate apps in PGBuild, but this will allow sharing one www with two different app namespaces.



来源:https://stackoverflow.com/questions/24541766/change-widget-id-or-package-name-for-android-ios-platform-on-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!