NOTIFICATION_ID ++; mnotificationmanager = (notificationmanager) this.getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallicon(R.drawable.ic_launcher) .setContentTitle(msg.getString("Title")) .setContentText(msg.getString("message")) .setDefaults(Notification.DEFAulT_SOUND) .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(Picasso.with(getApplicationContext()).load(msg.getString("icon")).get()).setSummaryText(msg.getString("message"))) .setautoCancel(true); Log.e("msg---",msg.toString()); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new Componentname(this,ActivityDetail.class));// intent.setAction(Intent.ACTION_MAIN); intent.addcategory(Intent.category_LAUNCHER);// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(Keys._PostID,msg.getString("ID")); intent.putExtra(Keys._Image,msg.getString("icon")); intent.putExtra(Keys._PostType,msg.getString("post_type")); PendingIntent contentIntent = PendingIntent.getActivity(this,intent,0); mBuilder.setContentIntent(contentIntent); mnotificationmanager.notify(NOTIFICATION_ID,mBuilder.build());解决方法 像这样创建你的PendingIntent并做一个技巧
PendingIntent contentIntent = PendingIntent.getActivity(this,(int) (Math.random() * 100),PendingIntent.FLAG_UPDATE_CURRENT);总结
以上是内存溢出为你收集整理的android – 推送通知打开Activity具有相同的意图全部内容,希望文章能够帮你解决android – 推送通知打开Activity具有相同的意图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)