标签:
int icon = R.drawable.ic_launcher; long when = System.currentTimeMillis(); Notification noti = new Notification(icon, contentTitle, when); noti.flags |= flag; PackageManager pm = context.getPackageManager(); Intent notificationIntent = pm.getLaunchIntentForPackage(context.getPackageName()); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); notificationIntent.putExtra("notificationTag", tag); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); noti.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 上面的方法解决不了 notificationIntent.setAction(Intent.ACTION_MAIN); notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); 这样就可以了
标签:
原文地址:http://www.cnblogs.com/yujian-bcq/p/4684308.html