读书人

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

发布时间: 2012-08-27 21:21:57 作者: rapoo

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

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

也许每次只能用一个吧

+ 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);

读书人网 >移动开发

热点推荐