notification 发起音乐背景灯以及震动的施用

notification 发起音乐背景灯以及震动的使用

我本来打算全部使用这几种效果 但是呢 只有震动一种效果,不知道为啥权限也加了

也许每次只能用一个吧

Notification notification = new Notification(icon, tickerText, when); 
 
        context
= context.getApplicationContext(); 
       
CharSequence contentTitle = "UK Radio Guide"; 
 
       
CharSequence contentText = title + " on " + channel_id + " at " + start; 
 
       
Intent notificationIntent = new Intent(context, ViewSchedules.class); 
       
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); 
 
        notification
.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 
 
        notification
.ledARGB = 0xff00ff00; 
        notification
.ledOnMS = 300; 
        notification
.ledOffMS = 1000; 
        notification
.flags |= Notification.FLAG_SHOW_LIGHTS; 
 
 
 
        notification
.sound = Uri.parse("android.resource://com.robinwilson.radioguide/" +R.raw.chimes); 
        notification
.vibrate = new long[] { 0, 300, 200, 300, 400, 300 }; 
 
       
// Actually send the notification 
        nm
.notify(0, notification); 

1 楼 mesmes 2010-08-25  
背景灯可以使用:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);