客户提供的手机是 zte 型号zd-p1-tj3使用的是yunos 3.0.2系统,我一开始使用信鸽推送消息,在手机下拉时看到了接收到的消息,但是通知栏没有任何提醒。一开始我以为是信鸽推送的问题,但是....
我新建个工程然后写了下面的demo来测试在yunos平台下通知提醒的效果...代码如下
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.drawable.ic_notification)
.setTicker("TickerText:" + "您有新短消息,请注意查收!")
.setContentTitle("Notification Title")
.setContentText("This is the notification message")
.setSound(Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.tip))
.setPriority(Notification.PRIORITY_MAX)
.setContentIntent(pendingIntent)
.setNumber(1);
Notification notify3 = builder.build();
notify3.flags |= Notification.FLAG_AUTO_CANCEL;
manager.notify(1, notify3);
但是居然没有任何的声音提示,通知栏也没有提示图标,只能下拉时看到发出的提醒消息。我在设置中看了,应用的通知是打开的。如下图
经过我调试发现原本设置Priority为MAX,但是在执行过manager.notify(1, notify3);后Priority变为MIN,不知道是不是和这个有关
然后我用微信试了下,奇了怪了微信可以提示声音,通知栏也有文字和图标的提示信息。我想问下yunos系统如何能显示通知栏的信息?微信使用的是什么手段做到的?
谢谢各位了