如果发布极光推送官方更新了新的插件,我们如何将WeX5中使用的极光推送插件更新呢?

答案很简单,只需要按以下步骤进行即可:

1. 去https://github.com/jpush/jpush-phonegap-plugin下载最新版的cordova插件
2. 修改文件夹的名字为插件的id即:cn.jpush.phonegap.JPushPlugin
3. 将原来插件中的plugin-ex.xml文件拷贝到新版的插件中去
4. 修改新版插件的plugin.xml文件,

①在xml中找到这句话,

<preference name="API_KEY" />

把它删除,因为我们配置参数的机制稍有不同;

②修改参数的名字:在iOS平台的配置下找到

<config-file target="*PushConfig.plist" parent="APP_KEY">
     <string>$API_KEY</string>
</config-file>

将其修改为

<config-file target="*PushConfig.plist" parent="APP_KEY">
     <string>$jpush_appkey</string>
</config-file>

在Android平台的配置中找到:

<meta-data android:name="JPUSH_APPKEY" android:value="$API_KEY"/>

修改为

<meta-data android:name="JPUSH_APPKEY" android:value="$jpush_appkey"/>

③找到:

<js-module src="www/JPushPlugin.js" name="JPushPlugin">
        <clobbers target="jPushPlugin"/>
</js-module>

修改为:

<js-module src="www/JPushPlugin.js" name="JPushPlugin">
        <clobbers target="window.plugins.jPushPlugin"/>
</js-module>

这样就可以了!