开发者

Playing ringtone & vibrating phone?

Notification notification = new Notification(icon, tickerText, when); 
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 
notification.defaults |= Notification.DEFAULT_SOUND; 
notification.defaults |= Notification.DEFAULT_VIBRATE; 
notification.defaults |= Notification.DEF开发者_JAVA百科AULT_LIGHTS; 
notification.flags |= Notification.FLAG_AUTO_CANCEL; 

notification.flags |= Notification.FLAG_SHOW_LIGHTS; 
notification.ledARGB = 0xff00ff00; 
notification.ledOnMS = 300; 
notification.ledOffMS = 1000; 

Change in manifest :
<uses-permission 
        android:name="android.permission.VIBRATE"></uses-permission> 

I have added the above code. its running without errors. But no effects are seen. Does it run on android 1.5 ???


You need to wrap this notification setup into a notification manager call.

See some tutorial about notificationmanager

mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mManager.notify(APP_ID, notification);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜