service 监听推送,然后点通知栏。无法启动应用
我在activity下绑定了一个service,用于监听服务器推送。然后在收到推送后在service里创建一个通知栏。可是在点击后没有去启动应用。特来求教该怎么改。
代码如下:
messageIntent = new Intent(this,Cocos2dxActivity.class);
messageIntent.addCategory(Intent.CATEGORY_LAUNCHER);
messageIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|
messageIntent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
messagePendingIntent = PendingIntent.getActivity(this, 0, messageIntent, 0);
messageNotification.setLatestEventInfo(ServerPushService.this.getBaseContext(), "您有新消息!", "这是一条新的测试消息", messagePendingIntent);
楼主试了下如果是了activity里创建通知栏 这种方式可以启动应用的。但是在service里是不能取到activity的内容。