我使用这些代码行在我的应用程序中显示通知,但索尼设备(xperia p,sola,acro s)不显示任何通知。我没有任何其他的Android设备的问题。通知:索尼设备不显示任何通知
Intent notificationIntent = new Intent(context, ActivityShowQuestion.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context,
Integer.parseInt(id), notificationIntent,
PendingIntent.FLAG_ONE_SHOT);
NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(context);
builder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentTitle("title")
.setContentText("text");
Notification n = builder.build();
nm.notify(id, n);
我使用Google搜索,但找不到任何答案。
我有第一个体验和即时通讯与代码即时通讯使用,它有点不同,要我发布 – JRowan 2013-05-01 08:40:15
是的谢谢,如果有可能 – 2013-05-01 08:42:32