notification Led灯

public class NotificationUtils {     public static void showStatusbarNotification(Context context, CharSequence text) {         NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);         Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());         notification.ledARGB = Color.BLUE;         notification.ledOnMS = 100;         notification.ledOffMS = 100;         notification.defaults |= Notification.DEFAULT_LIGHTS;         notification.flags = notification.flags |             Notification.DEFAULT_LIGHTS |             Notification.FLAG_ONLY_ALERT_ONCE |             Notification.FLAG_SHOW_LIGHTS;         CharSequence contentTitle = context.getText(R.string.app_name);         CharSequence contentText = text;         Intent notificationIntent = new Intent(context, MyActivity.class);         PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);         notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);         nm.notify(0, notification);     } }

你可能感兴趣的:(notification)