【发布时间】:2012-07-22 10:15:17
【问题描述】:
我有一个在后台运行的服务,如果有新数据,我想通知用户,我使用了一个通知管理器,通知出现了,但是当点击它时它什么也没做(它是应该显示一个活动 我是 android 新手,这是我的代码
NotificationManager notificationmanager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = newNotification(R.drawable.shoppingcarticon, "Nouvelle notification de ShopAlert", System.currentTimeMillis());
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(this,GooglemapActivity.class);
PendingIntent activity = PendingIntent.getService(this, 0, intent, 0);
notification.setLatestEventInfo(this, "This is the title", "This is the text", activity);
notification.number += 1;
notificationmanager.notify(0, notification);
您的帮助将不胜感激。
【问题讨论】:
标签: android service notificationmanager