List of usage examples for android.app Notification getChannelId
public String getChannelId()
From source file:ti.modules.titanium.android.notificationmanager.NotificationManagerModule.java
@Kroll.method public void notify(int id, Object notificationValue) { NotificationProxy notificationProxy = NotificationProxy.fromObject(notificationValue); NotificationManager manager = getManager(); if (manager != null && notificationProxy != null) { // targeting Android O or above? create default channel try {/*from w ww . j a va2 s . c om*/ notificationProxy.setCurrentId(id); Notification notification = notificationProxy.getNotification(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notification.getChannelId() == DEFAULT_CHANNEL_ID) { useDefaultChannel(); } getManager().notify(id, notification); HashMap wakeParams = notificationProxy.getWakeParams(); if (wakeParams != null) { int wakeTime = TiConvert.toInt(wakeParams.get("time"), 3000); int wakeFlags = TiConvert.toInt(wakeParams.get("flags"), (PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE)); PowerManager pm = (PowerManager) TiApplication.getInstance() .getSystemService(TiApplication.getInstance().getApplicationContext().POWER_SERVICE); if (pm != null && !pm.isScreenOn()) { try { WakeLock wl = pm.newWakeLock(wakeFlags, "TiWakeLock"); wl.acquire(wakeTime); } catch (IllegalArgumentException e) { Log.e(TAG, e.getMessage()); } } } } catch (Exception e) { } } }