1

我在安装Android应用程序(使用PhoneGap build)时计划本地通知时出现问题。Android - 在PhoneGap Build/Apache Cordova上安排本地通知4.1.1

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

我使用下面的插件尝试:

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设备上时,一切正常。通知按计划启动。

然而,试图此版本提交给谷歌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科尔多瓦V4.1.1被接受Google Play。

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

+0

@RaGu看看下面的链接基本的本地通知工作样本 - https://github.com/gandhirajan/ Cordova_Local_Notification希望它能帮助你入门 – Gandhi

+0

查看以下链接中的基本本地通知工作示例 - github.com/gandhirajan/Cordova_Local_Notification希望它能帮助您开始使用 – Gandhi

回答

1

变化

<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" /> 
0

我有固定的我自己。

更改插件名称将工作。

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

就我而言,我已经改变了

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

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