开发者

vibration and sound won't be played

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜