[英]localnotification for phonegap android?
试图按照用户使用phonegap android使用Cordova 2.2.0设置的日期和时间发出警报或提醒,已从此处下载phonegap localnotification插件: phonegap android localnotification插件我才刚刚入门,并在文件的这一行出现错误命名为:ALARMRECEIVER.JAVA:
// Construct the notification and notificationManager objects
final NotificationManager notificationMgr = (NotificationManager) systemService;
final Notification notification = new Notification(R.drawable.ic_launcher, tickerText,
System.currentTimeMillis());
final PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(), 0);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.vibrate = new long[] { 0, 100, 200, 300 };
notification.setLatestEventInfo(context, notificationTitle, notificationSubText, contentIntent);
/*
* If you want all reminders to stay in the notification bar, you should
* generate a random ID. If you want do replace an existing
* notification, make sure the ID below matches the ID that you store in
* the alarm intent.
*/
notificationMgr.notify(notificationId, notification);
错误仅在此行上:
final Notification notification = new Notification(R.drawable.ic_launcher, tickerText,
System.currentTimeMillis());
红色高亮显示我:
R cannot be resolved to a variable
只是由于单个错误而无法运行此项目
从插件自述文件中:
修复在AlarmReceiver.java中第67行附近的导入,在该行中引用了R.drawable.ic_launcher,使其与项目中的图标匹配
确保在/ res /文件夹中有一个名为ic_launcher的图标。 然后还要检查/ res /文件夹中的任何文件,是否没有任何XML错误。 R类是从/ res /文件夹自动生成的,如果缺少某些类,或者XML错误等,则不会创建R类,从而导致此错误。 如果仍然出现错误,请尝试执行Make-> Clean。 关于缺少R文件或未生成R,StackOverflow还有其他一些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.