开发者

vibration and sound won't be played

开发者 https://www.devze.com 2023-03-12 00:57 出处:网络
I have the following code: String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

I have the following code:

String ns = Context.NOTIFICATION_SERVICE;
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

    CharSequence tickerText = "HI!";
    long when = System.currentTimeMillis();

    Notification notificati开发者_高级运维on = new Notification(R.drawable.droid,
            tickerText, when);

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.flags |= Notification.DEFAULT_SOUND;
    notification.flags |= Notification.DEFAULT_LIGHTS;
    notification.flags |= Notification.DEFAULT_VIBRATE;

for some reason - none of the flags really applied except for the auto cancel.

No vibration, no sound, no lights.

What can cause this? I tried in 3.1 & in 2.2.1

Thanks


Try:

notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.defaults |= Notification.DEFAULT_VIBRATE;
0

精彩评论

暂无评论...
验证码 换一张
取 消