Example usage for android.app Notification FLAG_SHOW_LIGHTS

List of usage examples for android.app Notification FLAG_SHOW_LIGHTS

Introduction

In this page you can find the example usage for android.app Notification FLAG_SHOW_LIGHTS.

Prototype

int FLAG_SHOW_LIGHTS

To view the source code for android.app Notification FLAG_SHOW_LIGHTS.

Click Source Link

Document

Bit to be bitwise-ored into the #flags field that should be set if you want the LED on for this notification.

Usage

From source file:com.near.chimerarevo.services.NewsService.java

private void createNotification() {
    if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean("notification_pref", true))
        return;//from ww w . java 2s . co  m

    Intent intent = new Intent(this, MainActivity.class);
    PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);

    NotificationCompat.BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    bigStyle.bigText(getResources().getString(R.string.text_newposts_summary));
    bigStyle.setBigContentTitle(getResources().getString(R.string.app_name));

    NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender()
            .setContentIcon(R.drawable.ic_logo_cr_mini).setHintHideIcon(true);

    Notification n = new NotificationCompat.Builder(this)
            .setContentTitle(getResources().getString(R.string.app_name))
            .setContentText(getResources().getString(R.string.text_newposts_summary))
            .setSmallIcon(R.drawable.ic_logo_cr_mini).setContentIntent(pIntent).extend(wearableExtender)
            .setAutoCancel(true).build();

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("notification_vibrate_pref", true))
        n.defaults |= Notification.DEFAULT_VIBRATE;
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("notification_sound_pref", true))
        n.defaults |= Notification.DEFAULT_SOUND;
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("notification_light_pref", true)) {
        n.ledARGB = getLEDColor();
        n.ledOnMS = 300;
        n.ledOffMS = 1000;
        n.flags |= Notification.FLAG_SHOW_LIGHTS;
    }

    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
    notificationManager.notify(0, n);
}

From source file:com.ushahidi.android.app.BackgroundService.java

private void showNotification(String tickerText) {

    // This is what should be launched if the user selects our notification.
    Intent baseIntent = new Intent(this, IncidentTab.class);
    baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, baseIntent, 0);

    // choose the ticker text
    newUshahidiReportNotification = new Notification(R.drawable.notification_icon, tickerText,
            System.currentTimeMillis());
    newUshahidiReportNotification.contentIntent = contentIntent;
    newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL;
    newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL;
    newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent);

    if (Preferences.ringtone) {
        // set the ringer
        Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3"));
        newUshahidiReportNotification.sound = ringURI;
    }/* www. j  a v  a 2s  .  com*/

    if (Preferences.vibrate) {
        double vibrateLength = 100 * Math.exp(0.53 * 20);
        long[] vibrate = new long[] { 100, 100, (long) vibrateLength };
        newUshahidiReportNotification.vibrate = vibrate;

        if (Preferences.flashLed) {
            int color = Color.BLUE;
            newUshahidiReportNotification.ledARGB = color;
        }

        newUshahidiReportNotification.ledOffMS = (int) vibrateLength;
        newUshahidiReportNotification.ledOnMS = (int) vibrateLength;
        newUshahidiReportNotification.flags = newUshahidiReportNotification.flags
                | Notification.FLAG_SHOW_LIGHTS;
    }

    mNotificationManager.notify(Preferences.NOTIFICATION_ID, newUshahidiReportNotification);
}

From source file:com.ushahidi.android.app.UshahidiService.java

private void showNotification(String tickerText) {

    // This is what should be launched if the user selects our notification.
    Intent baseIntent = new Intent(this, IncidentsTab.class);
    baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, baseIntent, 0);

    // choose the ticker text
    newUshahidiReportNotification = new Notification(R.drawable.favicon, tickerText,
            System.currentTimeMillis());
    newUshahidiReportNotification.contentIntent = contentIntent;
    newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL;
    newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL;
    newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent);

    if (UshahidiPref.ringtone) {
        // set the ringer
        Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3"));
        newUshahidiReportNotification.sound = ringURI;
    }/*www.jav  a  2  s. c o m*/

    if (UshahidiPref.vibrate) {
        double vibrateLength = 100 * Math.exp(0.53 * 20);
        long[] vibrate = new long[] { 100, 100, (long) vibrateLength };
        newUshahidiReportNotification.vibrate = vibrate;

        if (UshahidiPref.flashLed) {
            int color = Color.BLUE;
            newUshahidiReportNotification.ledARGB = color;
        }

        newUshahidiReportNotification.ledOffMS = (int) vibrateLength;
        newUshahidiReportNotification.ledOnMS = (int) vibrateLength;
        newUshahidiReportNotification.flags = newUshahidiReportNotification.flags
                | Notification.FLAG_SHOW_LIGHTS;
    }

    mNotificationManager.notify(UshahidiPref.NOTIFICATION_ID, newUshahidiReportNotification);
}

From source file:com.automated.taxinow.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *//*www.jav  a  2  s .c  o  m*/
private void generateNotification(Context context, String message) {
    // System.out.println("this is message " + message);
    // System.out.println("NOTIFICATION RECEIVED!!!!!!!!!!!!!!" + message);
    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);
    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, MainDrawerActivity.class);
    notificationIntent.putExtra("fromNotification", "notification");
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    System.out.println("notification====>" + message);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    // notification.defaults |= Notification.DEFAULT_LIGHTS;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.ledARGB = 0x00000000;
    notification.ledOnMS = 0;
    notification.ledOffMS = 0;
    notificationManager.notify(0, notification);
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
            "WakeLock");
    wakeLock.acquire();
    wakeLock.release();
}

From source file:com.mowares.massagerexpressclient.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *///from w  w  w  .ja  va  2  s  .com

private void generateNotification(Context context, String message) {
    // System.out.println("this is message " + message);
    // System.out.println("NOTIFICATION RECEIVED!!!!!!!!!!!!!!" + message);
    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);
    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, MainDrawerActivity.class);
    notificationIntent.putExtra("fromNotification", "notification");
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    //notification.setLatestEventInfo(context, title, message, intent);

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    System.out.println("notification====>" + message);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    // notification.defaults |= Notification.DEFAULT_LIGHTS;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.ledARGB = 0x00000000;
    notification.ledOnMS = 0;
    notification.ledOffMS = 0;
    notificationManager.notify(0, notification);
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
            "WakeLock");
    wakeLock.acquire();
    wakeLock.release();
}

From source file:pylapp.smoothclicker.android.notifiers.StatusBarNotifier.java

/**
 * Makes a unmovable notification with a dedicated LED color.
 * This notification is an "on going" one, and should be displayed will the app is clicking.
 *
 * @param type - The notification type/*from  ww  w . j  a  v a 2 s  .com*/
 * @param params -
 *               <ul>
 *                  <li>For CLICK_MADE :params[0] for the X coordinate, params[1] for the Y coordinate</li>
 *                  <li>For COUNT_DOWN :params[0] for the leaving time to display</li>
 *                  <li>Nothing otherwise</li>
 *               </ul>
 */
public void makeNotification(NotificationTypes type, long... params) {

    Logger.d(LOG_TAG, "New notification: " + type);

    NotificationCompat.Builder b = new NotificationCompat.Builder(mContext);
    b.setSmallIcon(R.drawable.notification_icon);
    b.setContentTitle(mContext.getString(R.string.notif_content_title));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        b.setVisibility(Notification.VISIBILITY_PUBLIC);

    if (type != NotificationTypes.CLICK_MADE && type != NotificationTypes.CLICKS_ON_GOING_BY_SERVICE) {
        Intent activityToStartOnClick = new Intent(mContext, ClickerActivity.class);
        activityToStartOnClick.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent pi = PendingIntent.getActivity(mContext, 0, activityToStartOnClick, 0);
        b.setContentIntent(pi);
    }

    NotificationManager nm = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
    Notification n = null;

    switch (type) {
    case CLICKS_ON_GOING_BY_APP:
        b.setContentText(mContext.getString(R.string.notif_content_text_clicks_on_going_app));
        b.setProgress(0, 0, true);
        b.setLights(0xff9c27b0, 1000, 500);
        n = b.build();
        n.flags |= Notification.FLAG_NO_CLEAR;
        n.flags |= Notification.FLAG_SHOW_LIGHTS;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_CLICK_PROCESS_ON_GOING_BY_APP, n);
        break;
    case CLICKS_ON_GOING_STANDALONE:
        b.setContentText(mContext.getString(R.string.notif_content_text_clicks_on_going_standalone));
        b.setProgress(0, 0, true);
        b.setLights(0xff9c27b0, 1000, 500);
        n = b.build();
        n.flags |= Notification.FLAG_NO_CLEAR;
        n.flags |= Notification.FLAG_SHOW_LIGHTS;
        n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_CLICK_PROCESS_ON_GOING_STANDALONE, n);
        break;
    case CLICKS_ON_GOING_BY_SERVICE:
        b.setContentText(mContext.getString(R.string.notif_content_text_clicks_on_going_service));
        b.setProgress(0, 0, true);
        b.setLights(0xff9c27b0, 1000, 500);
        n = b.build();
        n.flags |= Notification.FLAG_NO_CLEAR;
        n.flags |= Notification.FLAG_SHOW_LIGHTS;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_CLICK_PROCESS_ON_GOING_BY_SERVICE, n);
        break;
    case CLICKS_STOPPED:
        b.setContentText(mContext.getString(R.string.notif_content_text_clicks_stop));
        n = b.build();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_CLICK_PROCESS_STOPPED, n);
        break;
    case CLICKS_OVER:
        b.setContentText(mContext.getString(R.string.notif_content_text_clicks_over));
        n = b.build();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_CLICK_PROCESS_OVER, n);
        break;
    case WATCH_OVER:
        b.setContentText(mContext.getString(R.string.notif_content_text_watch_over));
        n = b.build();
        n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_WATCH_PROCESS_OVER, n);
        break;
    case CLICK_MADE:
        StringBuilder sb = new StringBuilder();
        sb.append(mContext.getString(R.string.notif_content_text_click_made));
        if (params != null && params.length == 2) {
            sb.append(" : ").append(params[0]).append(" / ").append(params[1]);
        }
        b.setContentText(sb.toString());
        n = b.build();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_CLICK_MADE, n);
        break;
    case SU_GRANTED:
        b.setContentText(mContext.getString(R.string.notif_content_text_su_granted));
        n = b.build();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_SU_GRANTED, n);
        break;
    case COUNT_DOWN:
        if (params != null && params.length == 1) {
            b.setContentText(mContext.getString(R.string.notif_content_text_countdown) + " " + params[0]);
        } else {
            b.setContentText(mContext.getString(R.string.notif_content_text_countdown));
        }
        n = b.build();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_NO_CLEAR;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH)
            n.flags |= Notification.FLAG_LOCAL_ONLY;
        nm.notify(NOTIF_COUNT_DOWN, n);
        break;
    }

}

From source file:edu.oakland.cse480.GCMIntentService.java

public void sendCustNotification(String incomingMsg) {
    Log.i("incomingMsg = ", "" + incomingMsg);
    int msgCode;/*from   w  w w  .j ava2 s .  com*/
    try {
        msgCode = Character.getNumericValue(incomingMsg.charAt(0));
    } catch (Exception e) {
        msgCode = 0;
    }
    String msg;
    //String[] separated = incomingMsg.split("|");
    //separated[0] = separated[0]; //discard
    //separated[1] = separated[1] + ""; 
    //separated[2] = separated[2] + ""; //Additional message with "" to negate a null

    boolean showNotification = true;

    Intent intent;

    switch (msgCode) {
    case 1:
        msg = "A new player joined the game";
        intent = new Intent("UpdateGameLobby");
        intent.putExtra("GAMESTARTED", false);
        this.sendBroadcast(intent);
        break;
    case 2:
        msg = "The game has started";
        intent = new Intent("UpdateGameLobby");
        intent.putExtra("GAMESTARTED", true);
        this.sendBroadcast(intent);
        break;
    case 3:
        msg = "It is your turn to bet";
        intent = new Intent("UpdateGamePlay");
        this.sendBroadcast(intent);
        //Stuff
        break;
    case 4:
        msg = "Flop goes";
        break;
    case 5:
        msg = "A card has been dealt";
        //Stuff
        break;
    case 6:
        msg = "The river card, has been dealt";
        //Stuff
        break;
    case 7:
        msg = "Hand is over. Winner was " + incomingMsg.substring(1);
        intent = new Intent("UpdateGamePlay");
        intent.putExtra("WINNER", "Winner of last hand: " + incomingMsg.substring(1));
        this.sendBroadcast(intent);
        //Stuff
        break;
    case 8:
        msg = "Game is over. Winner was " + incomingMsg.substring(1);
        intent = new Intent("UpdateGamePlay");
        intent.putExtra("WINNER", "Winner of Game: " + incomingMsg.substring(1));
        this.sendBroadcast(intent);
        //Stuff
        break;
    default:
        msg = "Switch case isn't working";
        showNotification = false;
        //Some default stuff
        break;
    }

    if (showNotification) {
        mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

        Intent newIntent = new Intent(this, Gameplay.class);
        newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0, newIntent, 0);

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_launcher).setContentTitle("Poker Notification")
                .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg);

        mBuilder.setContentIntent(contentIntent);
        Notification notification = mBuilder.build();
        notification.defaults |= Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND
                | Notification.DEFAULT_VIBRATE;
        notification.flags |= Notification.FLAG_AUTO_CANCEL | Notification.FLAG_SHOW_LIGHTS;

        mNotificationManager.notify(NOTIFICATION_ID, notification);

    }
}

From source file:com.arifin.taxi.penumpang.GCMIntentService.java

/**
 * Issues a notification to inform the user that server has sent a message.
 *///from w  ww  . j  a v a2 s  .  co m
private void generateNotification(Context context, String message) {
    // System.out.println("this is message " + message);
    // System.out.println("NOTIFICATION RECEIVED!!!!!!!!!!!!!!" + message);
    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    Notification notification = new Notification(icon, message, when);

    String title = context.getString(R.string.app_name);
    Intent notificationIntent = new Intent(context, MainDrawerActivity.class);
    notificationIntent.putExtra("fromNotification", "notification");
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    notification = builder.setContentIntent(intent).setSmallIcon(icon).setTicker(message).setWhen(when)
            .setAutoCancel(true).setContentTitle(title).setContentText(message).build();
    // mNM.notify(NOTIFICATION, notification);

    /*notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;*/

    System.out.println("notification====>" + message);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    // notification.defaults |= Notification.DEFAULT_LIGHTS;
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.ledARGB = 0x00000000;
    notification.ledOnMS = 0;
    notification.ledOffMS = 0;
    notificationManager.notify(0, notification);
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
            "WakeLock");
    wakeLock.acquire();
    wakeLock.release();
}

From source file:com.snippet.app.NotificationActivity.java

public void onButton5(final View v) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setLargeIcon(BitmapFactory.decodeResource(getResources(), android.R.drawable.sym_def_app_icon))
            .setSmallIcon(android.R.drawable.stat_notify_chat).setTicker("Light")
            .setContentTitle("ContentTitle")
            .setContentText("ContentText: Hello world! The quick brown fox jumps over the lazy dog.")
            .setSubText("SubText").setContentInfo("10").setAutoCancel(true);
    Intent resultIntent = new Intent(this, NotificationResultActivity.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(NotificationResultActivity.class);
    stackBuilder.addNextIntent(resultIntent);
    NotificationManager notificationManager = (NotificationManager) getSystemService(
            Context.NOTIFICATION_SERVICE);
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(resultPendingIntent);
    Notification notification = builder.build();
    notification.flags |= Notification.FLAG_SHOW_LIGHTS;
    notification.ledARGB = 0xff00ff00;/*from ww  w  .j  a  v  a2s. c o m*/
    notification.ledOnMS = 300;
    notification.ledOffMS = 1000;
    notificationManager.notify(5, notification);
}

From source file:com.aylanetworks.aura.GcmIntentService.java

private void sendNotification(String msg, String sound) {
    mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);

    // Find the launcher class for our application
    PackageManager pm = getPackageManager();
    String packageName = getPackageName();
    Intent query = new Intent(Intent.ACTION_MAIN);
    Class launcherClass = null;//from w ww .  j  a v a  2  s  .  c  om
    query.addCategory(Intent.CATEGORY_LAUNCHER);
    List<ResolveInfo> foundIntents = pm.queryIntentActivities(query, 0);
    for (ResolveInfo info : foundIntents) {
        if (TextUtils.equals(info.activityInfo.packageName, packageName)) {
            launcherClass = info.activityInfo.getClass();
        }
    }

    if (launcherClass == null) {
        Log.e(TAG, "Could not find application launcher class");
        return;
    }

    Intent appIntent = new Intent(this, launcherClass); // main activity of Ayla Control/aMCA
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, appIntent, 0);

    //Determine the sound to be played
    Uri soundUri = null;
    if (sound == null) {
        // NOP
        //PushNotification.playSound("bdth.mp3");
    } else if (sound.equals("none")) {
        // NOP
    } else if (sound.equals("default")) {
        soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); // TYPE_NOTIFICATION or TYPE_ALARM
    } else if (sound.equals("alarm")) {
        soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); // TYPE_NOTIFICATION or TYPE_ALARM
    } else {
        boolean playedSound;
        playedSound = PushNotification.playSound(sound);
        if (playedSound == false) {
            soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); // TYPE_NOTIFICATION or TYPE_ALARM
        }
    }

    // @formatter:off
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
            //.setSound(soundUri)
            .setSmallIcon(R.drawable.ic_push_icon).setContentTitle(getResources().getString(R.string.app_name))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setLights(0xFFff0000, 500, 500) // flashing red light
            .setContentText(msg).setAutoCancel(true)
            //.setPriority(Notification.FLAG_HIGH_PRIORITY)
            .setDefaults(Notification.DEFAULT_VIBRATE | Notification.FLAG_SHOW_LIGHTS);
    // @formatter:on

    if (soundUri != null) {
        mBuilder.setSound(soundUri);
    }
    mBuilder.setPriority(PRIORITY_MAX);
    mBuilder.setContentIntent(contentIntent);

    mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}