Android - 在 PhoneGap Build / Apache Cordova 4.1.1 上安排本地通知

Android - Scheduling Local Notifications on PhoneGap Build / Apache Cordova 4.1.1

我在尝试在 Android 应用程序(使用 PhoneGap 构建)上安排本地通知时遇到问题。

我正在尝试在设定的日期和时间安排本地通知(例如 2016 年 9 月 23 日 12:00pm)。

我试过使用以下插件:

https://build.phonegap.com/plugins/2081

我的 config.xml 文件如下所示:

<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns   = "http://www.w3.org/ns/widgets"
    xmlns:gap   = "http://phonegap.com/ns/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id          = "****"
    versionCode = "292000" 
    version     = "2.9.2" >

    <gap:config-file platform="android" parent="/manifest">
 <application android:debuggable="true" />
</gap:config-file>

<!-- versionCode is optional and Android only -->

<name>****</name>

<description>
   ****
</description>

<author href="****" email="****">
    ****
</author>

<icon src="icon.png" />
<allow-navigation href="*" />
<access origin="*" />

<preference name="phonegap-version" value="cli-5.2.0" />
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="23"/>

<gap:plugin name='cordova-plugin-whitelist' source='npm' />

<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.1" source="pgb" />

</widget>

然后我使用以下代码安排通知:

cordova.plugins.notification.local.schedule({
    title: $title,
    text: $message,
    at: $date
});

在为最新的 PhoneGap 版本 (cli-6.3.0) 构建时,我在 build.phonegap.com 站点上收到以下错误:

Error - Some official plugins have to be updated if using PhoneGap >= 4.0.0. Please upgrade the version of any plugins that may include the following file: LocalNotification.java

似乎插件没有更新到最新版本的 PhoneGap,导致构建失败。

我已经尝试构建插件的最新支持版本 (PhoneGap 3.7.0)。构建成功完成,当直接安装在 Android 设备上时,一切正常。通知如期触发。

但是,当尝试将此构建提交到 Google Play 商店时,构建被拒绝并出现以下错误:

Your APK has been rejected for containing security vulnerabilities, which violates the Malicious Behavior policy. The Alerts page has more information about how to resolve the issue. If you submitted an update, the previous version of your app is still live on Google Play.

构建现在需要使用 Apache Cordova v4.1.1 才能被 Google Play 接受。

我环顾四周,但找不到任何解决方案。有没有人知道一个修复程序,或者一个不同的插件,允许在支持 Apache Cordova v4.1.1 或更高版本的 Android 上安排本地通知?

改变

<gap:plugin name='cordova-plugin-whitelist' source='npm' />

<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.1" source="pgb" />

<plugin name='cordova-plugin-whitelist' source='npm' />

<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.4" source="npm" />

我自己修好了

更改插件名称即可。

我们需要找到合适的插件并替换 config.xml 中的旧版本。

就我而言,我已经改变了

<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.4" source="pgb" />

<gap:plugin name="trunk.plugin.local-notification" />