<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
  xmlns:android="http://schemas.android.com/apk/res/android"
  id="cordova-plugin-jpush"
  version="3.7.3">

    <name>JPush</name>
    <description>JPush for cordova plugin</description>
    <author>JPush</author>
    <keywords>JPush,push</keywords>
    <license>MIT License</license>

    <preference name="APP_KEY" />
    <preference name="CHANNEL" default="developer-default" />

    <preference name="HUAWEI_APPKEY" />
    <preference name="XIAOMI_APPID" />
    <preference name="XIAOMI_APPKEY" />
    <preference name="OPPO_APPID" />
    <preference name="OPPO_APPKEY" />
    <preference name="OPPO_APPSECRET" />
    <preference name="MEIZU_APPID" />
    <preference name="MEIZU_APPKEY" />
    <preference name="VIVO_APPID" />
    <preference name="VIVO_APPKEY" />

    <engines>
        <engine name="cordova" version=">=3.0" />
    </engines>

    <!-- dependencies -->
    <!-- <dependency id="cordova-plugin-pdevice" /> -->
    <dependency id="cordova-plugin-jcore" />

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

    <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="JPushPlugin">
                <param name="ios-package" value="JPushPlugin" />
            </feature>
        </config-file>
        <config-file target="*-Info.plist" parent="UIBackgroundModes">
            <array>
                <string>remote-notification</string>
            </array>
        </config-file>
        <config-file target="*-Debug.plist" parent="aps-environment">
            <string>development</string>
        </config-file>
        <config-file target="*-Release.plist" parent="aps-environment">
            <string>production</string>
        </config-file>
        <header-file src="src/ios/Plugins/JPushDefine.h" />
        <header-file src="src/ios/Plugins/JPushPlugin.h" />
        <source-file src="src/ios/Plugins/JPushPlugin.m" />
        <header-file src="src/ios/Plugins/AppDelegate+JPush.h" />
        <source-file src="src/ios/Plugins/AppDelegate+JPush.m" />

        <header-file src="src/ios/lib/JPUSHService.h" />
        <source-file src="src/ios/lib/jpush-ios-4.8.1.a" framework="true" />
        <resource-file src="src/ios/JPushConfig.plist" />

        <framework src="CFNetwork.framework" weak="true" />
        <framework src="CoreFoundation.framework" weak="true" />
        <framework src="CoreTelephony.framework" weak="true" />
        <framework src="SystemConfiguration.framework" weak="true" />
        <framework src="CoreGraphics.framework" weak="true" />
        <framework src="Foundation.framework" weak="true" />
        <framework src="UIKit.framework" weak="true" />
        <framework src="Security.framework" weak="true" />
        <framework src="libz.tbd" weak="true" />
        <framework src="AdSupport.framework" weak="true" />
        <framework src="UserNotifications.framework" weak="true" />
        <framework src="libresolv.tbd" weak="true" />

        <config-file target="*JPushConfig.plist" parent="Appkey">
            <string>$APP_KEY</string>
        </config-file>
    </platform>

    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="JPushPlugin">
                <param name="android-package" value="cn.jiguang.cordova.push.JPushPlugin" />
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest" mode="merge">
            <!-- Required  一些系统要求的权限，如访问网络等 -->
            <permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE"
                        android:protectionLevel="signature" />

            <!-- 小米Xiaomi推送 start -->
            <permission android:name="$PACKAGE_NAME.permission.MIPUSH_RECEIVE"
                        android:protectionLevel="signature" />
            <uses-permission android:name="$PACKAGE_NAME.permission.MIPUSH_RECEIVE" />
            <!-- 小米Xiaomi推送 end -->

            <!-- 魅族meizu推送 start -->
            <uses-permission android:name="com.meizu.c2dm.permission.RECEIVE" />
            <permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE"
                        android:protectionLevel="signature" />
            <uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
            <!-- 魅族meizu推送 end -->

            <!-- OPPO推送 start -->
            <uses-permission android:name="com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE"/>
            <!-- OPPO推送 end -->

            <!-- Required  一些系统要求的权限，如访问网络等-->
            <uses-permission android:name="$PACKAGE_NAME.permission.JPUSH_MESSAGE" />
            <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.READ_PHONE_STATE" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />



            <!-- Optional for location -->
            <uses-permission android:name="android.permission.VIBRATE" />
            <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
            <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
            <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /><!-- Android Q后台定位权限-->
            <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
            <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
            <uses-permission android:name="android.permission.GET_TASKS" />
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest/application" mode="merge">


            <!-- Rich push 核心功能 since 2.0.6-->
            <activity
                    android:name="cn.jpush.android.ui.PopWinActivity"
                    android:theme="@style/MyDialogStyle"
                    android:exported="false">
            </activity>

            <!-- Required SDK核心功能-->
            <activity
                    android:name="cn.jpush.android.ui.PushActivity"
                    android:configChanges="orientation|keyboardHidden"
                    android:theme="@android:style/Theme.NoTitleBar"
                    android:exported="false">
                <intent-filter>
                    <action android:name="cn.jpush.android.ui.PushActivity" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <category android:name="$PACKAGE_NAME" />
                </intent-filter>
            </activity>

            <!-- Required SDK 核心功能-->
            <!-- 可配置android:process参数将PushService放在其他进程中 -->
            <service
                    android:name="cn.jpush.android.service.PushService"
                    android:process=":pushcore"
                    android:exported="false">
                <intent-filter>
                    <action android:name="cn.jpush.android.intent.REGISTER" />
                    <action android:name="cn.jpush.android.intent.REPORT" />
                    <action android:name="cn.jpush.android.intent.PushService" />
                    <action android:name="cn.jpush.android.intent.PUSH_TIME" />
                </intent-filter>
            </service>

            <!-- 小米Xiaomi推送 start -->
            <service
                    android:name="com.xiaomi.push.service.XMJobService"
                    android:enabled="true"
                    android:exported="false"
                    android:permission="android.permission.BIND_JOB_SERVICE"
                    android:process=":pushservice"/>
            <service
                    android:name="com.xiaomi.push.service.XMPushService"
                    android:enabled="true"
                    android:process=":pushservice"/>
            <service
                    android:name="com.xiaomi.mipush.sdk.PushMessageHandler"
                    android:enabled="true"
                    android:exported="true"/>
            <service
                    android:name="com.xiaomi.mipush.sdk.MessageHandleService"
                    android:enabled="true"/>

            <receiver android:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver"
                      android:exported="true">
                <intent-filter>
                    <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
            </receiver>
            <receiver android:name="com.xiaomi.push.service.receivers.PingReceiver"
                      android:exported="false"
                      android:process=":pushservice">
                <intent-filter>
                    <action android:name="com.xiaomi.push.PING_TIMER"/>
                </intent-filter>
            </receiver>
            <receiver android:name="cn.jpush.android.service.PluginXiaomiPlatformsReceiver"
                      android:exported="true">
                <intent-filter>
                    <action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE"/>
                </intent-filter>
                <intent-filter>
                    <action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED"/>
                </intent-filter>
                <intent-filter>
                    <action android:name="com.xiaomi.mipush.ERROR"/>
                </intent-filter>
            </receiver>
            <!-- 小米Xiaomi推送 end -->

            <!-- OPPO推送 start -->
            <service android:name="cn.jpush.android.service.PluginOppoPushService">
                <intent-filter>
                    <action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE" />
                </intent-filter>
            </service>
            <!-- OPPO推送 end -->

            <!-- vivo推送 start -->
            <service android:name="com.vivo.push.sdk.service.CommandClientService"
                     android:exported="true" />

            <receiver android:name="cn.jpush.android.service.PluginVivoMessageReceiver">
                <intent-filter>
                    <!-- 接收 push 消息 -->
                    <action android:name="com.vivo.pushclient.action.RECEIVE" />
                </intent-filter>
            </receiver>

            <activity
                    android:name="com.vivo.push.sdk.LinkProxyClientActivity"
                    android:exported="false"
                    android:screenOrientation="portrait"
                    android:theme="@android:style/Theme.Translucent.NoTitleBar" />
            <!-- vivo推送 end -->

            <!-- 华为huawei推送 start-->
            <provider
                    android:name="com.huawei.hms.update.provider.UpdateProvider"
                    android:authorities="$PACKAGE_NAME.hms.update.provider"
                    android:exported="false"
                    android:grantUriPermissions="true">
            </provider>

            <receiver android:name="cn.jpush.android.service.PluginHuaweiPlatformsReceiver">
                <intent-filter>
                    <!-- 必须,用于接收token -->
                    <action android:name="com.huawei.android.push.intent.REGISTRATION" />
                    <!-- 必须,用于接收消息 -->
                    <action android:name="com.huawei.android.push.intent.RECEIVE" />
                    <!-- 可选,用于点击通知栏或通知栏上的按钮后触发onEvent回调 -->
                    <action android:name="com.huawei.android.push.intent.CLICK" />
                    <!-- 可选,查看push通道是否连接,不查看则不需要 -->
                    <action android:name="com.huawei.intent.action.PUSH_STATE" />
                </intent-filter>
                <meta-data
                        android:name="CS_cloud_ablitity"
                        android:value="successRateAnalytics" />
            </receiver>

            <activity
                    android:name="com.huawei.hms.activity.BridgeActivity"
                    android:configChanges="orientation|locale|screenSize|layoutDirection|fontScale"
                    android:excludeFromRecents="true"
                    android:exported="false"
                    android:hardwareAccelerated="true"
                    android:theme="@android:style/Theme.Translucent" >
                <meta-data
                        android:name="hwc-theme"
                        android:value="androidhwext:style/Theme.Emui.Translucent" />
            </activity>
            <!-- 华为huawei推送 end-->

            <!-- 魅族meizu推送 start -->
            <receiver android:name="cn.jpush.android.service.PluginMeizuPlatformsReceiver">
                <intent-filter>
                    <!-- 接收 push 消息 -->
                    <action android:name="com.meizu.flyme.push.intent.MESSAGE" />
                    <!-- 接收 register 消息 -->
                    <action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />
                    <!-- 接收 unregister 消息-->
                    <action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />
                    <!-- 兼容低版本 Flyme3 推送服务配置 -->
                    <action android:name="com.meizu.c2dm.intent.REGISTRATION" />
                    <action android:name="com.meizu.c2dm.intent.RECEIVE" />
                    <category android:name="$PACKAGE_NAME" />
                </intent-filter>
            </receiver>
            <!-- 魅族meizu推送 end -->

            <!-- since 3.0.9 Required SDK 核心功能-->
            <provider
                    android:authorities="$PACKAGE_NAME.DataProvider"
                    android:name="cn.jpush.android.service.DataProvider"
                    android:process=":pushcore"
                    android:exported="false"
            />

            <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
            <!-- 若不启用该功能可删除该组件，将不拉起其他应用也不能被其他应用拉起 -->
            <service
                    android:name="cn.jpush.android.service.DaemonService"
                    android:enabled="true"
                    android:exported="true">
                <intent-filter>
                    <action android:name="cn.jpush.android.intent.DaemonService" />
                    <category android:name="$PACKAGE_NAME" />
                </intent-filter>

            </service>

            <!-- since 3.1.0 Required SDK 核心功能-->
            <provider
                    android:authorities="$PACKAGE_NAME.DownloadProvider"
                    android:name="cn.jpush.android.service.DownloadProvider"
                    android:exported="true"
            />

            <!-- Required SDK核心功能-->
            <receiver
                    android:name="cn.jpush.android.service.PushReceiver"
                    android:enabled="true"
                    android:exported="false">
                <intent-filter android:priority="1000">
                    <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />   <!--Required  显示通知栏 -->
                    <category android:name="$PACKAGE_NAME" />
                </intent-filter>
                <intent-filter>
                    <action android:name="android.intent.action.USER_PRESENT" />
                    <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
                </intent-filter>
                <!-- Optional -->
                <intent-filter>
                    <action android:name="android.intent.action.PACKAGE_ADDED" />
                    <action android:name="android.intent.action.PACKAGE_REMOVED" />

                    <data android:scheme="package" />
                </intent-filter>
            </receiver>

            <!-- Required SDK核心功能-->
            <receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false"/>

            <!--since 3.3.0 接收JPush相关事件-->
            <receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
                <intent-filter>
                    <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
                    <category android:name="$PACKAGE_NAME"></category>
                </intent-filter>
            </receiver>

            <!--since 3.3.0 Required SDK核心功能-->
            <activity
                    android:name="cn.jpush.android.service.JNotifyActivity"
                    android:exported="true"
                    android:taskAffinity="jpush.custom"
                    android:theme="@android:style/Theme.Translucent.NoTitleBar">
                <intent-filter>
                    <action android:name="cn.jpush.android.intent.JNotifyActivity" />
                    <category android:name="$PACKAGE_NAME" />
                </intent-filter>
            </activity>

            <!-- since 3.3.0 Required SDK 核心功能-->
            <!-- 可配置android:process参数将PushService放在其他进程中 -->
            <!--User defined.  For test only 继承自cn.jpush.android.service.JCommonService-->
            <service android:name="cn.jiguang.cordova.push.PushService"
                     android:process=":pushcore">
                <intent-filter>
                    <action android:name="cn.jiguang.user.service.action" />
                </intent-filter>
            </service>


            <receiver
                    android:name="cn.jiguang.cordova.push.JPushReceiver"
                    android:enabled="true"
                    android:exported="false">
                <intent-filter>
                    <action android:name="cn.jpush.android.intent.REGISTRATION" />
                    <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
                    <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
                    <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
                    <action android:name="cn.jpush.android.intent.CONNECTION" />

                    <category android:name="$PACKAGE_NAME" />
                </intent-filter>
            </receiver>

            <!-- Required  . Enable it you can get statistics data with channel -->
            <meta-data android:name="JPUSH_CHANNEL" android:value="$CHANNEL"/>
            <meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" /> <!--  </>值来自开发者平台取得的AppKey-->
            <!-- 小米Xiaomi推送 start -->
            <meta-data android:name="XIAOMI_APPKEY" android:value="MI-$XIAOMI_APPKEY"/>
            <meta-data android:name="XIAOMI_APPID" android:value="MI-$XIAOMI_APPID"/>
            <!-- 小米Xiaomi推送 end -->

            <!-- 华为huawei推送 start-->
            <meta-data android:name="com.huawei.hms.client.appid" android:value="appid=$HUAWEI_APPKEY"/>
            <!-- 华为huawei推送 end-->

            <!-- 魅族meizu推送 start -->
            <meta-data android:name="MEIZU_APPKEY" android:value="MZ-$MEIZU_APPKEY" />
            <meta-data android:name="MEIZU_APPID" android:value="MZ-$MEIZU_APPID" />
            <!-- 魅族meizu推送 end -->

            <!-- OPPO推送 start -->
            <meta-data android:name="OPPO_APPID" android:value="OP-$OPPO_APPID" />
            <meta-data android:name="OPPO_APPKEY" android:value="OP-$OPPO_APPKEY" />
            <meta-data android:name="OPPO_APPSECRET" android:value="OP-$OPPO_APPSECRET" />
            <!-- OPPO推送 end -->

            <!-- vivo推送 start -->
            <meta-data android:name="com.vivo.push.app_id" android:value="$VIVO_APPID" />
            <meta-data android:name="com.vivo.push.api_key" android:value="$VIVO_APPKEY" />
            <!-- vivo推送 end -->
        </config-file>

        <!-- 小米Xiaomi推送 start -->
        <lib-file src="src/android/third-push/xiaomi/libs/jpush-android-plugin-xiaomi-v3.3.8.jar" />
        <lib-file src="src/android/third-push/xiaomi/libs/MiPush_SDK_Client_3_6_18.jar" />
        <!-- 小米Xiaomi推送 end -->

        <!-- 华为huawei推送 start-->
        <lib-file src="src/android/third-push/huawei/libs/jpush-android-plugin-huawei-v3.3.8.jar" />
        <lib-file src="src/android/third-push/huawei/libs/hmssdk-2.6.3.306.jar" />

        <resource-file src="src/android/third-push/huawei/res" target="res" />
        <resource-file src="src/android/third-push/huawei/assets" target="assets" />
        <!-- 华为huawei推送 end-->

        <!-- 魅族meizu推送 start -->
        <lib-file src="src/android/third-push/meizu/libs/jpush-android-plugin-meizu-v3.3.8.jar" />
        <lib-file src="src/android/third-push/meizu/libs/meizu-push-3.8.1.jar" />
        <!-- 魅族meizu推送 end -->

        <!-- OPPO推送 start -->
        <lib-file src="src/android/third-push/oppo/libs/jpush-android-plugin-oppo-v3.3.8.jar" />
        <lib-file src="src/android/third-push/oppo/libs/com.coloros.mcssdk.jar" />
        <!-- OPPO推送 end -->

        <!-- vivo推送 start -->
        <lib-file src="src/android/third-push/vivo/libs/jpush-android-plugin-vivo-v3.3.8.jar" />
        <lib-file src="src/android/third-push/vivo/libs/pushsdk_v2.3.1.jar" />
        <!-- vivo推送 end -->

        <!-- 极光推送 start -->
        <lib-file src="src/android/libs/jpush-android-3.3.8.jar" />

        <source-file src="src/android/PushService.java" target-dir="src/cn/jiguang/cordova/push" />
        <source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
        <source-file src="src/android/JPushReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
        <source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />

        <resource-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
          target="res/drawable/jpush_richpush_btn_selector.xml" />
        <resource-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml"
          target="res/drawable/jpush_richpush_progressbar.xml" />

        <resource-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png"
          target="res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png" />
        <resource-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png"
          target="res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png" />

        <resource-file src="src/android/res/layout/jpush_popwin_layout.xml"
          target="res/layout/jpush_popwin_layout.xml" />
        <resource-file src="src/android/res/layout/jpush_webview_layout.xml"
          target="res/layout/jpush_webview_layout.xml" />
        <resource-file src="src/android/res/layout/push_notification.xml"
          target="res/layout/push_notification.xml" />

        <resource-file src="src/android/res/values/jpush_style.xml"
                       target="res/values/jpush_style.xml" />
        <resource-file src="src/android/res/values/jpush_string.xml"
                       target="res/values/jpush_string.xml" />

        <resource-file src="src/android/res/values-zh/jpush_string.xml"
                       target="res/values-zh/jpush_string.xml" />
    </platform>
</plugin>
