Hi,
How can I make the LED or trackball pulse or flash while my application is running and the screen is on ? Like when a phonecall is received for instance ?
Thanks
Hi,
How can I make the LED or trackball pulse or flash while my application is running and the screen is on ? Like when a phonecall is received for instance ?
Thanks
I wrote this class some time ago, but I was not able to make it work (even using different combinations of flags) You could find this post useful.
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);
}
}