Example usage for android.support.v4.app TaskStackBuilder addNextIntent

List of usage examples for android.support.v4.app TaskStackBuilder addNextIntent

Introduction

In this page you can find the example usage for android.support.v4.app TaskStackBuilder addNextIntent.

Prototype

public TaskStackBuilder addNextIntent(Intent nextIntent) 

Source Link

Document

Add a new Intent to the task stack.

Usage

From source file:com.keylesspalace.tusky.util.NotificationHelper.java

private static NotificationCompat.Builder newNotification(Context context, Notification body,
        AccountEntity account, boolean summary) {
    Intent summaryResultIntent = new Intent(context, MainActivity.class);
    summaryResultIntent.putExtra(ACCOUNT_ID, account.getId());
    TaskStackBuilder summaryStackBuilder = TaskStackBuilder.create(context);
    summaryStackBuilder.addParentStack(MainActivity.class);
    summaryStackBuilder.addNextIntent(summaryResultIntent);

    PendingIntent summaryResultPendingIntent = summaryStackBuilder.getPendingIntent(notificationId,
            PendingIntent.FLAG_UPDATE_CURRENT);

    // we have to switch account here
    Intent eventResultIntent = new Intent(context, MainActivity.class);
    eventResultIntent.putExtra(ACCOUNT_ID, account.getId());
    TaskStackBuilder eventStackBuilder = TaskStackBuilder.create(context);
    eventStackBuilder.addParentStack(MainActivity.class);
    eventStackBuilder.addNextIntent(eventResultIntent);

    PendingIntent eventResultPendingIntent = eventStackBuilder.getPendingIntent((int) account.getId(),
            PendingIntent.FLAG_UPDATE_CURRENT);

    Intent deleteIntent = new Intent(context, NotificationClearBroadcastReceiver.class);
    deleteIntent.putExtra(ACCOUNT_ID, account.getId());
    PendingIntent deletePendingIntent = PendingIntent.getBroadcast(context,
            summary ? (int) account.getId() : notificationId, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(context, getChannelId(account, body))
            .setSmallIcon(R.drawable.ic_notify)
            .setContentIntent(summary ? summaryResultPendingIntent : eventResultPendingIntent)
            .setDeleteIntent(deletePendingIntent)
            .setColor(BuildConfig.DEBUG ? Color.parseColor("#19A341")
                    : ContextCompat.getColor(context, R.color.primary))
            .setGroup(account.getAccountId()).setAutoCancel(true).setDefaults(0); // So it doesn't ring twice, notify only in Target callback

    setupPreferences(account, builder);/*  w  w w.j ava2  s .c  om*/

    return builder;
}

From source file:com.android.mail.widget.WidgetService.java

public static void configureValidWidgetIntents(Context context, RemoteViews remoteViews, int appWidgetId,
        Account account, final int folderType, final int folderCapabilities, final Uri folderUri,
        final Uri folderConversationListUri, final String folderDisplayName, Class<?> serviceClass) {
    remoteViews.setViewVisibility(R.id.widget_configuration, View.GONE);

    // Launch an intent to avoid ANRs
    final Intent intent = new Intent(context, serviceClass);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    intent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize());
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_TYPE, folderType);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CAPABILITIES, folderCapabilities);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_URI, folderUri);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CONVERSATION_LIST_URI, folderConversationListUri);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName);
    intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
    remoteViews.setRemoteAdapter(R.id.conversation_list, intent);
    // Open mail app when click on header
    final Intent mailIntent = Utils.createViewFolderIntent(context, folderUri, account);
    mailIntent.setPackage(context.getPackageName());
    PendingIntent clickIntent = PendingIntent.getActivity(context, 0, mailIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);

    // On click intent for Compose
    final Intent composeIntent = new Intent();
    composeIntent.setPackage(context.getPackageName());
    composeIntent.setAction(Intent.ACTION_SEND);
    composeIntent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize());
    composeIntent.setData(account.composeIntentUri);
    composeIntent.putExtra(ComposeActivity.EXTRA_FROM_EMAIL_TASK, true);
    if (account.composeIntentUri != null) {
        composeIntent.putExtra(Utils.EXTRA_COMPOSE_URI, account.composeIntentUri);
    }/*from   www  . j a v a  2s  .c  om*/

    // Build a task stack that forces the conversation list on the stack before the compose
    // activity.
    final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
    clickIntent = taskStackBuilder.addNextIntent(mailIntent).addNextIntent(composeIntent).getPendingIntent(0,
            PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent);

    // On click intent for Conversation
    final Intent conversationIntent = new Intent();
    conversationIntent.setPackage(context.getPackageName());
    conversationIntent.setAction(Intent.ACTION_VIEW);
    clickIntent = PendingIntent.getActivity(context, 0, conversationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setPendingIntentTemplate(R.id.conversation_list, clickIntent);
}

From source file:net.mceoin.cominghome.LocationService.java

/**
 * Posts a notification in the notification bar when a transition is detected.
 * If the user clicks the notification, control goes to the main Activity.
 *
 *//*from  w  w  w.  java  2s.  c  o  m*/
public static void sendTrackingNotification(Context context) {

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    boolean notifications = prefs.getBoolean(MainActivity.PREFS_NOTIFICATIONS, true);

    if (!notifications) {
        if (debug)
            Log.d(TAG, "notifications are turned off");
        return;
    }

    // Create an explicit content Intent that starts the main Activity
    Intent notificationIntent = new Intent(context, MainActivity.class);

    // Construct a task stack
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);

    // Adds the main Activity to the task stack as the parent
    stackBuilder.addParentStack(MainActivity.class);

    // Push the content Intent onto the stack
    stackBuilder.addNextIntent(notificationIntent);

    // Get a PendingIntent containing the entire back stack
    PendingIntent notificationPendingIntent = stackBuilder.getPendingIntent(0,
            PendingIntent.FLAG_UPDATE_CURRENT);

    // Get a notification builder that's compatible with platform versions >= 4
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context);

    // Set the notification contents
    builder.setSmallIcon(R.drawable.home)
            .setContentTitle(context.getString(R.string.tracking_notification_title)).setOngoing(true)
            .setContentText(context.getString(R.string.tracking_notification_text))
            .setContentIntent(notificationPendingIntent);

    // Get an instance of the Notification manager
    NotificationManager mNotificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    // Issue the notification
    mNotificationManager.notify(NOTIFICATION_TRACKING, builder.build());
}

From source file:com.chen.mail.widget.WidgetService.java

public static void configureValidWidgetIntents(Context context, RemoteViews remoteViews, int appWidgetId,
        Account account, final int folderType, final Uri folderUri, final Uri folderConversationListUri,
        final String folderDisplayName, Class<?> serviceClass) {
    remoteViews.setViewVisibility(R.id.widget_configuration, View.GONE);

    // Launch an intent to avoid ANRs
    final Intent intent = new Intent(context, serviceClass);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    intent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize());
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_TYPE, folderType);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_URI, folderUri);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CONVERSATION_LIST_URI, folderConversationListUri);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName);
    intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
    remoteViews.setRemoteAdapter(R.id.conversation_list, intent);
    // Open mail app when click on header
    final Intent mailIntent = Utils.createViewFolderIntent(context, folderUri, account);
    PendingIntent clickIntent = PendingIntent.getActivity(context, 0, mailIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);

    // On click intent for Compose
    final Intent composeIntent = new Intent();
    composeIntent.setAction(Intent.ACTION_SEND);
    composeIntent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize());
    composeIntent.setData(account.composeIntentUri);
    composeIntent.putExtra(ComposeActivity.EXTRA_FROM_EMAIL_TASK, true);
    if (account.composeIntentUri != null) {
        composeIntent.putExtra(Utils.EXTRA_COMPOSE_URI, account.composeIntentUri);
    }//from w  w w .jav  a  2  s  .  co m

    // Build a task stack that forces the conversation list on the stack before the compose
    // activity.
    final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
    clickIntent = taskStackBuilder.addNextIntent(mailIntent).addNextIntent(composeIntent).getPendingIntent(0,
            PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent);

    // On click intent for Conversation
    final Intent conversationIntent = new Intent();
    conversationIntent.setAction(Intent.ACTION_VIEW);
    clickIntent = PendingIntent.getActivity(context, 0, conversationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setPendingIntentTemplate(R.id.conversation_list, clickIntent);
}

From source file:com.tlongdev.bktf.util.Utility.java

public static void createSimpleNotification(Context context, int id, String title, String message) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.drawable.ic_notification).setContentTitle(title).setContentText(message)
            .setAutoCancel(true)/*from w w  w  . jav a2 s .  c  om*/
            //.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
            .setColor(ContextCompat.getColor(context, R.color.primary))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(message));

    // Creates an explicit intent for an Activity in your app
    Intent resultIntent = new Intent(context, MainActivity.class);

    // The stack builder object will contain an artificial back stack for the
    // started Activity.
    // This ensures that navigating backward from the Activity leads out of
    // your application to the Home screen.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    // Adds the back stack for the Intent (but not the Intent itself)
    stackBuilder.addParentStack(MainActivity.class);
    // Adds the Intent that starts the Activity to the top of the stack
    stackBuilder.addNextIntent(resultIntent);
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(resultPendingIntent);
    NotificationManager mNotificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    // mId allows you to update the notification later on.
    mNotificationManager.notify(id, builder.build());
}

From source file:com.tct.mail.widget.WidgetService.java

public static void configureValidWidgetIntents(Context context, RemoteViews remoteViews, int appWidgetId,
        Account account, final int folderType, final int folderCapabilities, final Uri folderUri,
        final Uri folderConversationListUri, final String folderDisplayName, Class<?> serviceClass) {
    remoteViews.setViewVisibility(R.id.widget_configuration, View.GONE);

    // Launch an intent to avoid ANRs
    final Intent intent = new Intent(context, serviceClass);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    intent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize());
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_TYPE, folderType);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CAPABILITIES, folderCapabilities);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_URI, folderUri);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CONVERSATION_LIST_URI, folderConversationListUri);
    intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName);
    intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
    remoteViews.setRemoteAdapter(R.id.conversation_list, intent);
    remoteViews.setEmptyView(R.id.conversation_list, R.id.empty_conversation_list); //TS: zheng.zou 2015-08-11 EMAIL BUGFIX_1044483 ADD
    // Open mail app when click on header
    final Intent mailIntent = Utils.createViewFolderIntent(context, folderUri, account);
    PendingIntent clickIntent = PendingIntent.getActivity(context, 0, mailIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);

    // On click intent for Compose
    final Intent composeIntent = new Intent();
    composeIntent.setAction(Intent.ACTION_SEND);
    //TS: jian.xu 2015-4-24 EMAIL BUGFIX_984619 ADD_S
    composeIntent.setPackage(context.getPackageName());
    //TS: jian.xu 2015-4-24 EMAIL BUGFIX_984619 ADD_E
    composeIntent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize());
    composeIntent.setData(account.composeIntentUri);
    composeIntent.putExtra(ComposeActivity.EXTRA_FROM_EMAIL_TASK, true);
    composeIntent.putExtra(ComposeActivity.EXTRA_FROM_EMAIL_WIDGET, true); //TS: zheng.zou 2015-12-09 EMAIL BUGFIX_1059178 ADD
    if (account.composeIntentUri != null) {
        composeIntent.putExtra(Utils.EXTRA_COMPOSE_URI, account.composeIntentUri);
    }//from w  w w.  j  a va  2 s  .c  om

    // Build a task stack that forces the conversation list on the stack before the compose
    // activity.
    final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
    clickIntent = taskStackBuilder.addNextIntent(mailIntent).addNextIntent(composeIntent).getPendingIntent(0,
            PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent);

    // On click intent for Conversation
    final Intent conversationIntent = new Intent();
    conversationIntent.setAction(Intent.ACTION_VIEW);
    clickIntent = PendingIntent.getActivity(context, 0, conversationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    remoteViews.setPendingIntentTemplate(R.id.conversation_list, clickIntent);
}

From source file:com.visva.voicerecorder.utils.Utils.java

public static void showNotificationAtReminderTime(Context context, String title, String note) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.drawable.ic_launcher).setAutoCancel(true).setContentTitle(title)
            .setContentText(note);/*from   w w  w.j a v a  2 s  . c  om*/
    Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    builder.setSound(alarmSound);

    Intent resultIntent = new Intent(context, ActivityHome.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addParentStack(ActivityHome.class);
    stackBuilder.addNextIntent(resultIntent);

    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);
    builder.setContentIntent(resultPendingIntent);

    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(0, builder.build());
}

From source file:com.visva.voicerecorder.utils.Utils.java

public static void showNotificationAfterCalling(Context context, String phoneName, String phoneNo,
        String createdDate) {//from  w ww .  ja  va2s . c  om
    Resources res = context.getResources();
    String newRecord = res.getString(R.string.you_have_new_record);
    String favorite = res.getString(R.string.favourite);
    String addNote = res.getString(R.string.add_note);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.drawable.ic_launcher).setAutoCancel(true).setContentTitle(phoneName)
            .setContentText(newRecord);
    Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    builder.setSound(alarmSound);

    int isFavourite = Utils.isCheckFavouriteContactByPhoneNo(context, phoneNo);
    Bundle bundle = new Bundle();
    bundle.putString(MyCallRecorderConstant.EXTRA_PHONE_NAME, phoneName);
    bundle.putString(MyCallRecorderConstant.EXTRA_PHONE_NO, phoneNo);
    bundle.putString(MyCallRecorderConstant.EXTRA_CREATED_DATE, createdDate);
    if (isFavourite == 0) {
        //favorite intent
        Intent favoriteIntent = new Intent();
        favoriteIntent.setAction(MyCallRecorderConstant.FAVORITE_INTENT);
        favoriteIntent.putExtras(bundle);
        PendingIntent pendingFavoriteIntent = PendingIntent.getBroadcast(context,
                MyCallRecorderConstant.NOTIFICATION_ID, favoriteIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        builder.addAction(R.drawable.ic_star_outline_white_36dp, favorite, pendingFavoriteIntent);
    }

    //Make a note intent
    Intent makeNoteIntent = new Intent();
    makeNoteIntent.setAction(MyCallRecorderConstant.MAKE_NOTE_INTENT);
    makeNoteIntent.putExtras(bundle);
    PendingIntent pendingMakeNoteIntent = PendingIntent.getBroadcast(context,
            MyCallRecorderConstant.NOTIFICATION_ID, makeNoteIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    builder.addAction(R.drawable.ic_customer_create, addNote, pendingMakeNoteIntent);

    Intent resultIntent = new Intent(context, ActivityHome.class);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addParentStack(ActivityHome.class);
    stackBuilder.addNextIntent(resultIntent);

    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);
    builder.setContentIntent(resultPendingIntent);

    builder.setPriority(NotificationCompat.PRIORITY_MAX);
    builder.setWhen(0);

    NotificationManager mNotificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(MyCallRecorderConstant.NOTIFICATION_ID, builder.build());
}

From source file:com.glandorf1.joe.wsprnetviewer.app.sync.WsprNetViewerSyncAdapter.java

private static void notifyWspr(Context context, String bandName, String description, double snr) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String displayNotificationsKey = context.getString(R.string.pref_enable_notifications_key);

    // Get whether notifications are enabled in preferences.
    boolean notificationsEnabled = prefs.getBoolean(displayNotificationsKey,
            Boolean.parseBoolean(context.getString(R.string.pref_enable_notifications_default)));

    if (notificationsEnabled) {
        // Don't notify more often than the user-preference cutoff interval.
        // pref_last_notification is only stored; it is not displayed in the Settings menu.
        // pref_last_notification gets saved below, in editor.putLong(lastNotificationKey, ...).
        long prefMillis = 1000 * (long) Utility.cutoffSeconds(context);
        String lastNotificationKey = context.getString(R.string.pref_last_notification);
        long lastNotification = prefs.getLong(lastNotificationKey, 0);
        Date now = new Date(System.currentTimeMillis());
        Date last = new Date(lastNotification);

        if ((System.currentTimeMillis() - lastNotification) >= prefMillis) {
            // It's been long enough since the last notification; send a new one now.

            int iconId = Utility.getIconResourceForWsprCondition(snr);
            String title = context.getString(R.string.app_name);

            // Define the text of the wspr notification.
            String contentText = String.format(context.getString(R.string.format_notification), description,
                    bandName, Utility.formatSnr(context, snr));

            // NotificationCompatBuilder builds backward-compatible notifications.
            NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setSmallIcon(iconId)
                    .setContentTitle(title).setContentText(contentText);

            // Open this app if the user clicks on the notification.
            Intent resultIntent = new Intent(context, MainActivity.class);
            TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
            stackBuilder.addParentStack(MainActivity.class);
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            mBuilder.setContentIntent(resultPendingIntent);
            NotificationManager mNotificationManager = (NotificationManager) context
                    .getSystemService(Context.NOTIFICATION_SERVICE);
            // mId allows you to update the notification later on.
            mNotificationManager.notify(WSPR_NOTIFICATION_ID, mBuilder.build());

            //refreshing last sync
            SharedPreferences.Editor editor = prefs.edit();
            editor.putLong(lastNotificationKey, System.currentTimeMillis());
            editor.commit();/* w ww  . ja va2 s . c  o  m*/
        }
    }
}

From source file:holidayiq.com.geofenced.geofence.GeofenceTransitionsIntentService.java

/**
 * Posts a notification in the notification bar when a transition is detected.
 * If the user clicks the notification, control goes to the MainActivity.
 *//*from w ww  . j  a  va2s.  c om*/
public static void sendNotification(final String title, final String content, String deeplink,
        final Context context, boolean isBanner) {
    // Create an explicit content Intent that starts the main Activity.
    Intent notificationIntent = new Intent(context, MainActivity.class);
    //notificationIntent.putExtra(HIQConstant.DATA_DEEPLINK_FLOW, deeplink);

    // Construct a task stack.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);

    // Add the main Activity to the task stack as the parent.
    stackBuilder.addParentStack(MainActivity.class);

    // Push the content Intent onto the stack.
    stackBuilder.addNextIntent(notificationIntent);

    // Get a PendingIntent containing the entire back stack.
    final PendingIntent notificationPendingIntent = stackBuilder.getPendingIntent(0,
            PendingIntent.FLAG_UPDATE_CURRENT);

    // Get a notification builder that's compatible with platform versions >= 4
    final NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    builder.setSmallIcon(R.drawable.ic_launcher);
    // In a real app, you may want to use a library like Volley
    // to decode the Bitmap.
    // .setLargeIcon(BitmapFactory.decodeResource(context.getResources(),
    //         R.mipmap.ic_launcher))
    builder.setContentTitle(title).setContentText(content)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(content))
            .setContentIntent(notificationPendingIntent);
    builder.setAutoCancel(true);
    String bannerUrl = HIQSharedPrefrence.getString("hotelDwellNotificationImage", context);
    if (isBanner && bannerUrl != null && !bannerUrl.isEmpty()) {

    } else {

        // Define the notification settings.
        builder.setSmallIcon(R.drawable.ic_launcher);
        // In a real app, you may want to use a library like Volley
        // to decode the Bitmap.
        builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
                .setContentTitle(title).setContentText(content)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(content))
                .setContentIntent(notificationPendingIntent);
        builder.setAutoCancel(true);
        int id = 0;

        // Get an instance of the Notification manager
        NotificationManager mNotificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(id, builder.build());

    }

    // Dismiss notification once the user touches it.

    int id = 0;
    // Issue the notification
    if (isDebug) {
        long time = new Date().getTime();
        String tmpStr = String.valueOf(time);
        String last4Str = tmpStr.substring(tmpStr.length() - 5);
        id = Integer.valueOf(last4Str);
    }
}