Java Code Examples for android.media.RingtoneManager#getDefaultUri()

The following examples show how to use android.media.RingtoneManager#getDefaultUri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncomingRinger.java    From bcm-android with GNU General Public License v3.0 6 votes vote down vote up
private MediaPlayer createPlayer() {
  try {
    MediaPlayer mediaPlayer = new MediaPlayer();
    Uri         ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);

    mediaPlayer.setOnErrorListener(new MediaPlayerErrorListener());
    mediaPlayer.setDataSource(context, ringtoneUri);
    mediaPlayer.setLooping(true);
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING);

    return mediaPlayer;
  } catch (Throwable tr) {
    Log.e(TAG, "Failed to create player for incoming call ringer");
    return null;
  }
}
 
Example 2
Source File: MyFirebaseMessagingService.java    From CourierApplication with Mozilla Public License 2.0 6 votes vote down vote up
private void sendNotification(Intent intent, String content, String title) {

        intent.putExtra(NOTIFICATION_TYPE, mType);

        PendingIntent pendingIntent = PendingIntent.getActivity(
                this, 0 /* Request code */, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.n_icon_couriers)
                .setContentText(content)
                .setContentTitle(title)
                .setAutoCancel(true)
                .setSound(defaultSoundUri)
                .setContentIntent(pendingIntent);

        NotificationManager notificationManager =
                (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

        notificationManager.notify(001 /* ID of notification */, notificationBuilder.build());
    }
 
Example 3
Source File: MyFirebaseMessagingService.java    From kute with Apache License 2.0 6 votes vote down vote up
/************************* Custom Functions****************/

    @TargetApi(16)
    private void sendBigNotification(String messageBody,PendingIntent pending_intent) {
        Log.d(TAG,"The message body is :"+messageBody);
        Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Bitmap Icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_directions_car_white_24dp);
        Bitmap image= BitmapFactory.decodeResource(getResources(), R.drawable.auto);
         Notification notification = new NotificationCompat.Builder(this)
                 .setStyle(new NotificationCompat.BigTextStyle()
                         .setBigContentTitle("KUTE")
                .bigText(messageBody))
                 .setSmallIcon(R.drawable.ic_people_black_24dp)
                .setLargeIcon(Icon)
                 .setContentTitle("KUTE")
                 .setContentText(messageBody)
                .setPriority(Notification.PRIORITY_MAX)
                .setSound(defaultSoundUri)
                .setContentIntent(pending_intent)
                .build();
        NotificationManager notificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

        notificationManager.notify(0 /* ID of notification */, notification);
    }
 
Example 4
Source File: RingtonePlayer.java    From q-municate-android with Apache License 2.0 6 votes vote down vote up
private Uri getNotification() {
    Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);

    if (notification == null) {
        // notification is null, using backup
        notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

        // I can't see this ever being null (as always have a default notification)
        // but just in case
        if (notification == null) {
            // notification backup is null, using 2nd backup
            notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
        }
    }
    return notification;
}
 
Example 5
Source File: MyFirebaseMessagingService.java    From CloudFunctionsExample with Apache License 2.0 6 votes vote down vote up
private void sendNotification(String notificationTitle, String notificationBody) {
    Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
            .setAutoCancel(true)   //Automatically delete the notification
            .setSmallIcon(R.mipmap.ic_launcher) //Notification icon
            .setContentIntent(pendingIntent)
            .setContentTitle(notificationTitle)
            .setContentText(notificationBody)
            .setSound(defaultSoundUri);


    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0, notificationBuilder.build());
}
 
Example 6
Source File: WifiScannerService.java    From karmadetector with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate() {
    SharedPreferences sharedPreferences = getSharedPreferences("karmaDetectorPrefs", Context.MODE_PRIVATE);
    wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, "WifiScannerService");
    defaultNotificationUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    shouldRun = true;
    int DEFAULT_SCAN_FREQ = 300;
    frequency = sharedPreferences.getInt("scanFrequency", DEFAULT_SCAN_FREQ);

    if (!wifiManager.isWifiEnabled()) {
        boolean ret = wifiManager.setWifiEnabled(true);
        if (!ret)
            addToLog("Problem activating Wifi. Active scans will not work.");
    }
    removeDecoyNetworks();
    createDecoyNetwork();

    startBroadcastReceiver();
    super.onCreate();
}
 
Example 7
Source File: GcmListenerSvc.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private void sendNotification(String body, String title) {
    Intent intent = new Intent(this, Home.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    Notification.Builder notificationBuilder = (Notification.Builder) new Notification.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle(title)
            .setContentText(body)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
 
Example 8
Source File: Conversions.java    From boilr with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Based on Stack Overflow answer by Beatlej
 * https://stackoverflow.com/a/28378096
 */
public static String getSystemRingtone(int ringtoneType, Context context) {
	Uri mediaUri = RingtoneManager.getDefaultUri(ringtoneType);
	if(mediaUri.getAuthority().equals(Settings.AUTHORITY)) {
		Cursor c = null;
		try {
			c = context.getContentResolver().query(mediaUri, new String[] { Settings.NameValueTable.VALUE }, null, null, null);
			if(c != null && c.moveToFirst()) {
				String val = c.getString(0);
				mediaUri = Uri.parse(val);
			}
		} catch(Exception e) {
			Log.e("Error getting system ringtone." + e);
		} finally {
			c.close();
		}
	}
	return mediaUri.toString();
}
 
Example 9
Source File: AlertPlugin.java    From microbit with Apache License 2.0 6 votes vote down vote up
private Uri searchAlarmUri(int alarmId) {
    Context context = MBApp.getApp();

    RingtoneManager ringtoneMgr = new RingtoneManager(context);
    ringtoneMgr.setType(RingtoneManager.TYPE_ALARM);
    Cursor alarms = ringtoneMgr.getCursor();
    Log.i(TAG, "playAlarm: total alarms = " + alarms.getCount());

    alarms.moveToPosition(alarmId - 4);
    Uri alarm = ringtoneMgr.getRingtoneUri(alarms.getPosition());

    if(alarm == null) {
        Log.i(TAG, "Cannot play nth Alarm. Playing default");
        alarm = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
    }

    return alarm;
}
 
Example 10
Source File: GPPListenerService.java    From GCMPushPlugin with MIT License 6 votes vote down vote up
/**
 * Create and show a notification containing the received GCM message.
 *
 * @param message GCM message received.
 */
private void sendNotification(JSONObject message) {
    Intent notificationIntent = new Intent(this, GPPActivity.class);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    notificationIntent.putExtra("extras",message.optString("extra").toString());
    
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(getApplicationInfo().icon)
            .setContentTitle(message.optString("title"))
            .setContentText(message.optString("text"))
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(contentIntent);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
 
Example 11
Source File: FakeCallFragment.java    From wmn-safety with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {

    Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
    Ringtone ringtone = RingtoneManager.getRingtone(getActivity(),notification);
    ringtone.play();
}
 
Example 12
Source File: WebRtcPhone.java    From Yahala-Messenger with MIT License 5 votes vote down vote up
public void Call(String id, boolean sendCallRequest, boolean videoCall) {
    mSendCallRequest = sendCallRequest;


    if (mSendCallRequest == true) {
        this.jid = id;
        this.videoCall = videoCall;
    } else {
        mRoomID = id;
    }

    if (!mSendCallRequest) {
        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
        ringtone = RingtoneManager.getRingtone(ApplicationLoader.applicationContext, notification);
        ringtone.play();

        connectToRoom(false, 0, true, videoCall);
          /*  Utilities.stageQueue.postRunnable(new Runnable() {
                @Override
                public void run() {

                }
          },delay);*/
    } else {

        connectToRoom(false, 0, false, videoCall);
    }

}
 
Example 13
Source File: ProximityService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a notification showing information about a device that got disconnected.
 */
private void createLinkLossNotification(final BluetoothDevice device) {
    final NotificationCompat.Builder builder = getNotificationBuilder();
    builder.setColor(ContextCompat.getColor(this, R.color.orange));

    final Uri notificationUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
    // Make sure the sound is played even in DND mode
    builder.setSound(notificationUri, AudioManager.STREAM_ALARM);
    builder.setPriority(NotificationCompat.PRIORITY_HIGH);
    builder.setCategory(NotificationCompat.CATEGORY_ALARM);
    builder.setShowWhen(true);
    // An ongoing notification would not be shown on Android Wear.
    builder.setOngoing(false);
    // This notification is to be shown not in a group

    final String name = getDeviceName(device);
    builder.setContentTitle(getString(R.string.proximity_notification_link_loss_alert, name));
    builder.setTicker(getString(R.string.proximity_notification_link_loss_alert, name));

    final Notification notification = builder.build();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        startForeground(NOTIFICATION_ID, notification);
    } else {
        final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        nm.notify(device.getAddress(), NOTIFICATION_ID, notification);
    }
}
 
Example 14
Source File: AssetUtil.java    From showCaseCordova with Apache License 2.0 5 votes vote down vote up
/**
 * Parse path path to native URI.
 *
 * @param path
 *      Path to path file
 */
Uri parseSound (String path) {

    if (path == null || path.isEmpty())
        return Uri.EMPTY;

    if (path.equalsIgnoreCase(DEFAULT_SOUND)) {
        return RingtoneManager.getDefaultUri(RingtoneManager
                .TYPE_NOTIFICATION);
    }

    return parse(path);
}
 
Example 15
Source File: QmsNewMessagesReceiver.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
private void playNotification(Context context) {
    try {

        Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        Ringtone r = RingtoneManager.getRingtone(context, notification);
        r.play();
    } catch (Exception e) {
    }
}
 
Example 16
Source File: MainActivity.java    From android-apps with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	cancelNotification = (TextView) findViewById(R.id.cancelNotification);
	cancelNotification.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			cancelNotification();
		}
	});
	
	Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);  // get default notification sound
	long[] vibrate = { 100, 200, 300, 400 }; // get vibration value
	
	NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(this);
	nBuilder.setSmallIcon(R.drawable.ic_action_chat);
	nBuilder.setContentTitle("Sample Notification");
	nBuilder.setContentText("Welcome your app is running");
	nBuilder.setTicker("Alert!!!");
	nBuilder.setNumber(++numMessages);
	nBuilder.setSound(alarmSound); // set default notification sound
	nBuilder.setVibrate(vibrate); // set vibrate
	nBuilder.setAutoCancel(true); // hide/remove notification from notification panel
	
	
	Intent intentResult = new Intent(this, NotificationView.class);
	TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
	stackBuilder.addParentStack(NotificationView.class);
	
	
	stackBuilder.addNextIntent(intentResult);
	PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
	nBuilder.setContentIntent(resultPendingIntent);
	
	notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
	notificationManager.notify(notificationID, nBuilder.build());
}
 
Example 17
Source File: MyPreferenceFragment.java    From AnotherRSS with The Unlicense 4 votes vote down vote up
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
    if (s.equals("nightmode_use")) {
        boolean night = sharedPreferences.getBoolean("nightmode_use", false);
        int startH = sharedPreferences.getInt("nightmode_use_start", AnotherRSS.Config.DEFAULT_NIGHT_START);
        int stopH = sharedPreferences.getInt("nightmode_use_stop", AnotherRSS.Config.DEFAULT_NIGHT_STOP);
        if (night && AnotherRSS.inTimeSpan(startH, stopH)) {
            umm.setNightMode(UiModeManager.MODE_NIGHT_YES);
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
        } else {
            umm.setNightMode(UiModeManager.MODE_NIGHT_NO);
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
        }
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
            getActivity().recreate();
        }
    } else if (s.equals("notify_sound")) {
        int noteSnd = Integer.parseInt(
                getPreferenceManager().getSharedPreferences().getString(
                        "notify_sound",
                        AnotherRSS.Config.DEFAULT_notifySound
                )
        );
        switch (noteSnd) {
            case 1:
                Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                mp = MediaPlayer.create(getActivity(), sound);
                break;
            case 2:
                mp = MediaPlayer.create(getActivity(), R.raw.notifysnd);
                break;
            case 3:
                mp = MediaPlayer.create(getActivity(), R.raw.dideldoing);
                break;
            case 4:
                mp = MediaPlayer.create(getActivity(), R.raw.doding);
                break;
            case 5:
                mp = MediaPlayer.create(getActivity(), R.raw.ploing);
                break;
            default:
                break;
        }
        if (mp != null && !mp.isPlaying()) {
            mp.start();
        }
    }
}
 
Example 18
Source File: BrewTimerService.java    From biermacht with Apache License 2.0 4 votes vote down vote up
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
  if (intent == null) {
    Log.e("BrewTimerService", "NULL intent passed to brew timer service.  Likely due to " +
            "a service restart.  Canceling the service!");
    stopSelf();
    return Service.START_STICKY;
  }

  // Use the service ID to keep track of our corresponding notification
  notificationId = startId;
  notificationStarted = false;

  // Get the desire title and time from the intent
  notificationTitle = intent.getStringExtra(Constants.KEY_TITLE);
  currentStepNumber = intent.getIntExtra(Constants.KEY_STEP_NUMBER, 0);
  r = intent.getParcelableExtra(Constants.KEY_RECIPE);
  int startTime = intent.getIntExtra(Constants.KEY_SECONDS, - 1);

  // Create and register a new Timer.  This will count down and broadcast the remaining time.
  timer = new Timer(this);

  // Register timer receivers
  registerReceivers();

  // Set up ringtone to alert user when timer is complete.
  Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
  if (uri == null) {
    uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  }
  ringtone = RingtoneManager.getRingtone(this, uri);

  // Start the timer
  timer.start(startTime);

  // Create the notification
  updateNotification(notificationTitle, startTime);

  // Indicate that the service is running
  BrewTimerService.isRunning = true;

  return Service.START_STICKY;
}
 
Example 19
Source File: MessageUtil.java    From GcmForMojo with GNU General Public License v3.0 4 votes vote down vote up
private static void sendNotificationSys(Context context, String msgTitle, String msgBody, String msgId, int notifyId, int msgCount)
{
    Intent intent = new Intent(context, CurrentUserActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Bundle msgListBundle = new Bundle();
    msgListBundle.putString("userName", msgTitle);
    msgListBundle.putString("userId", msgId);
    msgListBundle.putString("userType", SYS);
    msgListBundle.putString("userMessage", msgBody);
    msgListBundle.putString("userTime", getCurTime());
    msgListBundle.putString("senderType", "1");
    msgListBundle.putInt("notifyId", notifyId);
    msgListBundle.putString("msgCount", String.valueOf(msgCount));
    intent.putExtras(msgListBundle);
    PendingIntent pendingIntent = PendingIntent.getActivity(context, notifyId /* Request code */, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    Bundle msgNotifyBundle = new Bundle();
    msgNotifyBundle.putInt("notifyId", notifyId);

    //通知清除事件
    Intent intentCancel = new Intent(context, SysNotificationBroadcastReceiver.class);
    intentCancel.setAction("sys_notification_cancelled");
    intentCancel.putExtras(msgNotifyBundle);
    PendingIntent pendingIntentCancel = PendingIntent.getBroadcast(context, notifyId, intentCancel, PendingIntent.FLAG_ONE_SHOT);

    StringBuffer tickerSys = new StringBuffer();
    tickerSys.append(msgTitle);
    tickerSys.append("\r\n");
    tickerSys.append(msgBody);

    if (msgCount != 1)
    {
        msgTitle = msgTitle + "(" + msgCount +context.getString(R.string.notify_title_msgcount_new) +")";
    }

    int smallIcon;
    Bitmap largeIcon;

    switch (msgId) {
        case "1":
            smallIcon = R.drawable.qq_notification;
            largeIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.qq);
            break;
        case "2":
            smallIcon = R.drawable.weixin_notification;
            largeIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.weixin);
            break;
        default:
            smallIcon = R.drawable.sys_notification;
            largeIcon = BitmapFactory.decodeResource(context.getResources(), R.mipmap.sys);
    }

    int defaults = 0;
    defaults |= Notification.DEFAULT_LIGHTS;
    defaults |= Notification.DEFAULT_VIBRATE;
    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
            .setSmallIcon(smallIcon)
            .setLargeIcon(largeIcon)
            .setTicker(tickerSys)
            .setContentTitle(msgTitle)
            .setStyle(new NotificationCompat.BigTextStyle() // 设置通知样式为大型文本样式
                    .bigText(msgBody))
            .setContentText(msgBody)
        //    .setSubText(context.getString(R.string.notification_group_sys_name))
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setDefaults(defaults)
            .setContentIntent(pendingIntent)
            .setDeleteIntent(pendingIntentCancel);
    notificationBuilder.setPriority(Notification.PRIORITY_HIGH); //自动弹出通知
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        notificationBuilder.setColor(context.getResources().getColor(R.color.colorPrimary));
    }
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
        notificationBuilder.setChannelId(context.getString(R.string.notification_channel_sys_id));
    }

    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(notifyId, notificationBuilder.build());
}
 
Example 20
Source File: GcmModule.java    From react-native-gcm-android with MIT License 4 votes vote down vote up
@ReactMethod
public void createNotification(ReadableMap infos) {
    Resources resources = getReactApplicationContext().getResources();

    String packageName = getReactApplicationContext().getPackageName();

    Class intentClass = getMainActivityClass();

    Log.d(TAG, "packageName: " + packageName);

    if (intentClass == null) {
        Log.d(TAG, "intentClass is null");
        return;
    }

    int largeIconResourceId = resources.getIdentifier(infos.getString("largeIcon"), "mipmap", packageName);
    int smallIconResourceId = android.R.drawable.ic_dialog_info;
    if(infos.hasKey("smallIcon")){
        smallIconResourceId = resources.getIdentifier(infos.getString("smallIcon"), "mipmap", packageName);
    }
    Intent intent = new Intent(getReactApplicationContext(), intentClass);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(getReactApplicationContext(), 0, intent,
            PendingIntent.FLAG_ONE_SHOT);

    Bitmap largeIcon = BitmapFactory.decodeResource(resources, largeIconResourceId);

    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getReactApplicationContext())
            .setLargeIcon(largeIcon)
            .setSmallIcon(smallIconResourceId)
            .setContentTitle(infos.getString("subject"))
            .setContentText(infos.getString("message"))
            .setAutoCancel(infos.getBoolean("autoCancel"))
            .setSound(defaultSoundUri)
            .setTicker(infos.getString("ticker"))
            .setCategory(NotificationCompat.CATEGORY_CALL)
            .setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
            .setPriority(NotificationCompat.PRIORITY_HIGH)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager =
            (NotificationManager) getReactApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);

    Notification notif = notificationBuilder.build();
    notif.defaults |= Notification.DEFAULT_VIBRATE;
    notif.defaults |= Notification.DEFAULT_SOUND;
    notif.defaults |= Notification.DEFAULT_LIGHTS;

    notificationManager.notify(0, notif);
}