试图让Android的LocalNotification插件PhoneGap的在科尔多瓦-1.6.0工作 [英] Trying to get the Android LocalNotification plugins for phonegap to work in cordova-1.6.0
问题描述
我想升级的PhoneGap-1.4.1项目使用LocalNotification插件为Android科尔多瓦-1.6.0
I'm trying to upgrade a phonegap-1.4.1 project that uses the LocalNotification plugin for Android to cordova-1.6.0
我发现这个链接在这里: https://github.com/ davejohnson / PhoneGap的-插件,Facebook的连接/拉/ 109 凡说,为Android:使用CordovaInterface对象this.ctx.getContext()方法来获得Conext对象
I found this link here: https://github.com/davejohnson/phonegap-plugin-facebook-connect/pull/109 Where it says, For Android: use this.ctx.getContext() method of CordovaInterface object to get Conext object.
我编辑LocalNotification.java,并得到我的项目通过更改以下行没有错误编译:
I edited LocalNotification.java and got my project to compile without errors by changing the following lines:
alarm = new AlarmHelper(this.ctx);
...
final SharedPreferences alarmSettings = this.ctx.getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE);
...
final Editor alarmSettingsEditor = this.ctx.getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
...
final Editor alarmSettingsEditor = this.ctx.getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
...
final Editor alarmSettingsEditor = this.ctx.getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
到
alarm = new AlarmHelper(this.ctx.getContext());
...
final SharedPreferences alarmSettings = this.ctx.getContext().getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE);
...
final Editor alarmSettingsEditor = this.ctx.getContext().getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
...
final Editor alarmSettingsEditor = this.ctx.getContext().getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
...
final Editor alarmSettingsEditor = this.ctx.getContext().getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
不过,我必须承认,我真的不知道我在做什么,并通知不工作,我不明白,在应用中的任何错误日志:(
However I must admit that I don't really know what I'm doing and the notifications don't work and I don't get any errors in the applications log :(
也只注意到按在我的onDeviceReady()函数的例子中,我有以下几点:
Also just noticed that as per the example in my onDeviceReady() function I have the following:
console.log("Device ready");
if (typeof plugins !== "undefined") {
plugins.localNotification.add({
date : new Date(),
message : "Phonegap - Local Notification\r\nSubtitle comes after linebreak",
ticker : "This is a sample ticker text",
repeatDaily : false,
id : 4
});
}
如果我删除了,如果条件的typeof插件==未定义然后我得到我的应用程序日志中的错误是:未捕获的ReferenceError:插件没有定义
If I remove the the if condition typeof plugins !== "undefined" then I get an error in my app log which is: Uncaught ReferenceError: plugins is not defined
我想别的东西在科尔多瓦改变。如果有一个指导地方升级安卓插件科尔多瓦是否将是有益的。
I guess something else as changed in cordova. If there is a guide somewhere for upgrading android plugins to cordova if would be useful.
推荐答案
升级到科尔多瓦-1.6.1的今天,它现在的作品;)
Upgraded to Cordova-1.6.1 today and it now works ;)
勇敢地承认,它可能是一个椅子/键盘接口问题。 想想,当我升级到1.6.0我忘了在我的index.html的标题
Brave enough to admit that it might have been a "chair/keyboard" interface issue. Think when I upgraded to 1.6.0 I forgot to change it in the header of my index.html
这篇关于试图让Android的LocalNotification插件PhoneGap的在科尔多瓦-1.6.0工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!