PushManager(Context context) {
    GeneralUtils.checkNotNull(context, "context");
    mContext = context;

    if (GeneralUtils.isAmazonDevice()) {
      pushRegistrar = new PushRegistrarADM(context);
    } else {
      pushRegistrar = new PushRegistrarGCM(context);
    }
  }
  private static void generateNotification(Context context, Intent intent, Handler handler) {
    Bundle extras = intent.getExtras();
    if (extras == null) {
      return;
    }

    extras.putBoolean("foregroud", GeneralUtils.isAppOnForeground(context));

    String title = (String) extras.get("title");
    String link = (String) extras.get("l");

    // empty message with no data
    Intent notifyIntent;
    if (link != null) {
      // we want main app class to be launched
      notifyIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
      notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    } else {
      notifyIntent = new Intent(context, PushHandlerActivity.class);
      notifyIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

      // pass all bundle
      notifyIntent.putExtra("pushBundle", extras);
    }

    // first string will appear on the status bar once when message is added
    CharSequence appName =
        context.getPackageManager().getApplicationLabel(context.getApplicationInfo());
    if (null == appName) {
      appName = "";
    }

    NotificationManager manager =
        (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    Notification notification =
        NotificationFactory.generateNotification(
            context, extras, appName, PushManager.sSoundType, PushManager.sVibrateType);

    if (mSimpleNotification) {
      createSimpleNotification(context, notifyIntent, notification, appName, title, manager);
    } else {
      createMultyNotification(context, notifyIntent, notification, appName, title, manager);
    }

    generateBroadcast(context, extras);
  }
  private static void generateNotification(Context context, Intent intent, Handler handler) {
    Bundle extras = intent.getExtras();
    if (extras == null) {
      return;
    }

    extras.putBoolean("foregroud", GeneralUtils.isAppOnForeground(context));

    String message = (String) extras.get("title");
    String header = (String) extras.get("header");
    String link = (String) extras.get("l");

    // empty message with no data
    Intent notifyIntent;
    if (link != null) {
      // we want main app class to be launched
      notifyIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
      notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    } else {
      notifyIntent = new Intent(context, PushHandlerActivity.class);
      notifyIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

      // pass all bundle
      notifyIntent.putExtra("pushBundle", extras);
    }

    if (header == null) {
      CharSequence appName =
          context.getPackageManager().getApplicationLabel(context.getApplicationInfo());
      if (null == appName) {
        appName = "";
      }

      header = appName.toString();
    }

    NotificationManager manager =
        (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    NotificationFactory notificationFactory;

    // is this banner notification?
    String bannerUrl = (String) extras.get("b");

    // also check that notification layout has been placed in layout folder
    int layoutId =
        context
            .getResources()
            .getIdentifier(
                BannerNotificationFactory.sNotificationLayout, "layout", context.getPackageName());

    if (layoutId != 0 && bannerUrl != null) {
      notificationFactory =
          new BannerNotificationFactory(
              context,
              extras,
              header,
              message,
              PreferenceUtils.getSoundType(context),
              PreferenceUtils.getVibrateType(context));
    } else {
      notificationFactory =
          new SimpleNotificationFactory(
              context,
              extras,
              header,
              message,
              PreferenceUtils.getSoundType(context),
              PreferenceUtils.getVibrateType(context));
    }
    notificationFactory.generateNotification();
    notificationFactory.addSoundAndVibrate();
    notificationFactory.addCancel();

    if (PreferenceUtils.getEnableLED(context)) notificationFactory.addLED(true);

    Notification notification = notificationFactory.getNotification();

    int messageId = PreferenceUtils.getMessageId(context);
    if (PreferenceUtils.getMultiMode(context) == true) {
      PreferenceUtils.setMessageId(context, ++messageId);
    }

    notification.contentIntent =
        PendingIntent.getActivity(
            context, messageId, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    manager.notify(messageId, notification);

    generateBroadcast(context, extras);

    DeviceFeature2_5.sendMessageDeliveryEvent(context, extras.getString("p"));
  }