2013-05-06 35 views
0

试图根据用户使用phonegap android设置使用科尔多瓦2.2.0设置的日期和时间提醒或提醒有从这里下载phonegap localnotification插件: phonegap android localnotification plugin 我刚刚达到其初始阶段,并获得此行的错误文件命名为:ALARMRECEIVER.JAVA:phonenot android localnotification?

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

只是因为一个错误无法运行此项目

回答

0

从插件自述:

修复进口在AlarmReceiver.java周围67行,其中 R.drawable.ic_launcher引用这样它与您的 项目中的图标相匹配

确保在/ res /文件夹中有一个名为ic_launcher的图标。然后检查你的/ res /文件夹中的任何文件中是否没有任何XML错误。 R类是从你的/ res /文件夹自动生成的,如果缺少某些东西,或者如果有错误的XML等,它将不会被创建,导致这个错误。如果您仍然遇到错误,请尝试执行Make - > Clean。在StackOverflow上还有一些关于丢失R文件或R没有生成的其他问题。

相关问题