Showing
5 changed files
with
9 additions
and
165 deletions
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.5.3' | 5 | + PUBLISH_VERSION = '4.5.5.4' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -257,7 +257,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -257,7 +257,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
257 | // b.setFullScreenIntent(pi, true); | 257 | // b.setFullScreenIntent(pi, true); |
258 | 258 | ||
259 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | 259 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
260 | - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | 260 | + NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_HIGH); |
261 | // notificationChannel.setDescription("Channel description"); | 261 | // notificationChannel.setDescription("Channel description"); |
262 | // notificationChannel.enableLights(true); | 262 | // notificationChannel.enableLights(true); |
263 | // notificationChannel.setLightColor(color); | 263 | // notificationChannel.setLightColor(color); |
... | @@ -270,7 +270,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -270,7 +270,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
270 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar | 270 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar |
271 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); | 271 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); |
272 | } else { | 272 | } else { |
273 | - NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | 273 | + NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); |
274 | Notification notification_build_with_largeicon = b.build(); | 274 | Notification notification_build_with_largeicon = b.build(); |
275 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar | 275 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar |
276 | if (nm != null) { | 276 | if (nm != null) { |
... | @@ -296,58 +296,6 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -296,58 +296,6 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
296 | 296 | ||
297 | } | 297 | } |
298 | 298 | ||
299 | - /* | ||
300 | - public void showNotification(Context context, String title, String ticker, | ||
301 | - String message, Intent newIntent, String tag, int id) { | ||
302 | - | ||
303 | - SecureRandom randomGenerator = new SecureRandom(); | ||
304 | - int uid = randomGenerator.nextInt(1000); | ||
305 | - WarpUtils.log("Showing notification with tag: " + tag + " and id: " | ||
306 | - + id); | ||
307 | - | ||
308 | - NotificationCompat.Builder builder = new NotificationCompat.Builder( | ||
309 | - context); | ||
310 | - int imageResource; | ||
311 | - int colorResource = 0; | ||
312 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
313 | - imageResource = context.getResources().getIdentifier("ic_notification_24dp", | ||
314 | - "drawable", context.getPackageName()); | ||
315 | - colorResource = context.getResources().getIdentifier("push_notifications_color", "color", context.getPackageName()); | ||
316 | - } else { | ||
317 | - imageResource = context.getResources().getIdentifier("ic_notification_logo", | ||
318 | - "drawable", context.getPackageName()); | ||
319 | - } | ||
320 | - if (imageResource == 0) { | ||
321 | - imageResource = android.R.drawable.btn_star; | ||
322 | - } | ||
323 | - if (colorResource != 0) { | ||
324 | - builder.setColor(context.getResources().getColor(colorResource)); | ||
325 | - } | ||
326 | - | ||
327 | - builder.setSmallIcon(imageResource); | ||
328 | - builder.setContentTitle(title).setContentText(message) | ||
329 | - .setSmallIcon(imageResource) | ||
330 | - .setAutoCancel(true); | ||
331 | - builder.setDefaults(Notification.DEFAULT_ALL); | ||
332 | - builder.setAutoCancel(true); | ||
333 | - builder.setOngoing(true); | ||
334 | - | ||
335 | - newIntent.setAction(Long.toString(System.currentTimeMillis())); | ||
336 | - PendingIntent pi; | ||
337 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
338 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
339 | - } else { | ||
340 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT); | ||
341 | - } | ||
342 | - builder.setContentIntent(pi); | ||
343 | - | ||
344 | - NotificationManager nm = (NotificationManager) context | ||
345 | - .getSystemService(NotificationManager.class); | ||
346 | - Notification notification_build = builder.build(); | ||
347 | - notification_build.flags = Notification.FLAG_AUTO_CANCEL; | ||
348 | - nm.notify(tag, uid, notification_build); | ||
349 | - }*/ | ||
350 | - | ||
351 | public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { | 299 | public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { |
352 | 300 | ||
353 | SecureRandom randomGenerator = new SecureRandom(); | 301 | SecureRandom randomGenerator = new SecureRandom(); |
... | @@ -462,7 +410,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -462,7 +410,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
462 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 410 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
463 | nm.notify(pc.getSessionUUID(), uid, notification_build); | 411 | nm.notify(pc.getSessionUUID(), uid, notification_build); |
464 | } else { | 412 | } else { |
465 | - NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | 413 | + NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); |
466 | Notification notification_build = b.build(); | 414 | Notification notification_build = b.build(); |
467 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 415 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
468 | if (nm != null) { | 416 | if (nm != null) { | ... | ... |
... | @@ -316,7 +316,7 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -316,7 +316,7 @@ public class HMSBaseMessagingService extends HmsMessageService { |
316 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar | 316 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar |
317 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); | 317 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); |
318 | } else { | 318 | } else { |
319 | - NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | 319 | + NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); |
320 | Notification notification_build_with_largeicon = b.build(); | 320 | Notification notification_build_with_largeicon = b.build(); |
321 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar | 321 | notification_build_with_largeicon.flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar |
322 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); | 322 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); |
... | @@ -341,58 +341,6 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -341,58 +341,6 @@ public class HMSBaseMessagingService extends HmsMessageService { |
341 | 341 | ||
342 | } | 342 | } |
343 | 343 | ||
344 | - /* | ||
345 | - public void showNotification(Context context, String title, String ticker, | ||
346 | - String message, Intent newIntent, String tag, int id) { | ||
347 | - | ||
348 | - SecureRandom randomGenerator = new SecureRandom(); | ||
349 | - int uid = randomGenerator.nextInt(1000); | ||
350 | - WarpUtils.log("Showing notification with tag: " + tag + " and id: " | ||
351 | - + id); | ||
352 | - | ||
353 | - NotificationCompat.Builder builder = new NotificationCompat.Builder( | ||
354 | - context); | ||
355 | - int imageResource; | ||
356 | - int colorResource = 0; | ||
357 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
358 | - imageResource = context.getResources().getIdentifier("ic_notification_24dp", | ||
359 | - "drawable", context.getPackageName()); | ||
360 | - colorResource = context.getResources().getIdentifier("push_notifications_color", "color", context.getPackageName()); | ||
361 | - } else { | ||
362 | - imageResource = context.getResources().getIdentifier("ic_notification_logo", | ||
363 | - "drawable", context.getPackageName()); | ||
364 | - } | ||
365 | - if (imageResource == 0) { | ||
366 | - imageResource = android.R.drawable.btn_star; | ||
367 | - } | ||
368 | - if (colorResource != 0) { | ||
369 | - builder.setColor(context.getResources().getColor(colorResource)); | ||
370 | - } | ||
371 | - | ||
372 | - builder.setSmallIcon(imageResource); | ||
373 | - builder.setContentTitle(title).setContentText(message) | ||
374 | - .setSmallIcon(imageResource) | ||
375 | - .setAutoCancel(true); | ||
376 | - builder.setDefaults(Notification.DEFAULT_ALL); | ||
377 | - builder.setAutoCancel(true); | ||
378 | - builder.setOngoing(true); | ||
379 | - | ||
380 | - newIntent.setAction(Long.toString(System.currentTimeMillis())); | ||
381 | - PendingIntent pi; | ||
382 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
383 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
384 | - } else { | ||
385 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT); | ||
386 | - } | ||
387 | - builder.setContentIntent(pi); | ||
388 | - | ||
389 | - NotificationManager nm = (NotificationManager) context | ||
390 | - .getSystemService(NotificationManager.class); | ||
391 | - Notification notification_build = builder.build(); | ||
392 | - notification_build.flags = Notification.FLAG_AUTO_CANCEL; | ||
393 | - nm.notify(tag, uid, notification_build); | ||
394 | - }*/ | ||
395 | - | ||
396 | public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { | 344 | public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { |
397 | 345 | ||
398 | SecureRandom randomGenerator = new SecureRandom(); | 346 | SecureRandom randomGenerator = new SecureRandom(); |
... | @@ -506,7 +454,7 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -506,7 +454,7 @@ public class HMSBaseMessagingService extends HmsMessageService { |
506 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 454 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
507 | nm.notify(pc.getSessionUUID(), uid, notification_build); | 455 | nm.notify(pc.getSessionUUID(), uid, notification_build); |
508 | } else { | 456 | } else { |
509 | - NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | 457 | + NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); |
510 | Notification notification_build = b.build(); | 458 | Notification notification_build = b.build(); |
511 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 459 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
512 | nm.notify(pc.getSessionUUID(), uid, notification_build); | 460 | nm.notify(pc.getSessionUUID(), uid, notification_build); | ... | ... |
... | @@ -196,7 +196,7 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -196,7 +196,7 @@ public abstract class WarpBaseIntentService extends IntentService { |
196 | b.build().flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar | 196 | b.build().flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar |
197 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 197 | nm.notify(pc.getSessionUUID(), uid, b.build()); |
198 | } else { | 198 | } else { |
199 | - NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | 199 | + NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); |
200 | Notification notification_build_with_largeicon = b.build(); | 200 | Notification notification_build_with_largeicon = b.build(); |
201 | b.build().flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar | 201 | b.build().flags = Notification.FLAG_AUTO_CANCEL; //notification with only large icon due to the two build notificaition is not canceled from bar |
202 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 202 | nm.notify(pc.getSessionUUID(), uid, b.build()); |
... | @@ -222,58 +222,6 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -222,58 +222,6 @@ public abstract class WarpBaseIntentService extends IntentService { |
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | - /* | ||
226 | - public void showNotification(Context context, String title, String ticker, | ||
227 | - String message, Intent newIntent, String tag, int id) { | ||
228 | - | ||
229 | - SecureRandom randomGenerator = new SecureRandom(); | ||
230 | - int uid = randomGenerator.nextInt(1000); | ||
231 | - WarpUtils.log("Showing notification with tag: " + tag + " and id: " | ||
232 | - + id); | ||
233 | - | ||
234 | - NotificationCompat.Builder builder = new NotificationCompat.Builder( | ||
235 | - context); | ||
236 | - int imageResource; | ||
237 | - int colorResource = 0; | ||
238 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
239 | - imageResource = context.getResources().getIdentifier("ic_notification_24dp", | ||
240 | - "drawable", context.getPackageName()); | ||
241 | - colorResource = context.getResources().getIdentifier("push_notifications_color", "color", context.getPackageName()); | ||
242 | - } else { | ||
243 | - imageResource = context.getResources().getIdentifier("ic_notification_logo", | ||
244 | - "drawable", context.getPackageName()); | ||
245 | - } | ||
246 | - if (imageResource == 0) { | ||
247 | - imageResource = android.R.drawable.btn_star; | ||
248 | - } | ||
249 | - if (colorResource != 0) { | ||
250 | - builder.setColor(context.getResources().getColor(colorResource)); | ||
251 | - } | ||
252 | - | ||
253 | - builder.setSmallIcon(imageResource); | ||
254 | - builder.setContentTitle(title).setContentText(message) | ||
255 | - .setSmallIcon(imageResource) | ||
256 | - .setAutoCancel(true); | ||
257 | - builder.setDefaults(Notification.DEFAULT_ALL); | ||
258 | - builder.setAutoCancel(true); | ||
259 | - builder.setOngoing(true); | ||
260 | - | ||
261 | - newIntent.setAction(Long.toString(System.currentTimeMillis())); | ||
262 | - PendingIntent pi; | ||
263 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
264 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
265 | - } else { | ||
266 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT); | ||
267 | - } | ||
268 | - builder.setContentIntent(pi); | ||
269 | - | ||
270 | - NotificationManager nm = (NotificationManager) context | ||
271 | - .getSystemService(NotificationManager.class); | ||
272 | - Notification notification_build = builder.build(); | ||
273 | - notification_build.flags = Notification.FLAG_AUTO_CANCEL; | ||
274 | - nm.notify(tag, uid, notification_build); | ||
275 | - }*/ | ||
276 | - | ||
277 | public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { | 225 | public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { |
278 | 226 | ||
279 | SecureRandom randomGenerator = new SecureRandom(); | 227 | SecureRandom randomGenerator = new SecureRandom(); |
... | @@ -381,7 +329,7 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -381,7 +329,7 @@ public abstract class WarpBaseIntentService extends IntentService { |
381 | b.build().flags = Notification.FLAG_AUTO_CANCEL; | 329 | b.build().flags = Notification.FLAG_AUTO_CANCEL; |
382 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 330 | nm.notify(pc.getSessionUUID(), uid, b.build()); |
383 | } else { | 331 | } else { |
384 | - NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | 332 | + NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); |
385 | // Notification notification_build = b.build(); | 333 | // Notification notification_build = b.build(); |
386 | b.build().flags = Notification.FLAG_AUTO_CANCEL; | 334 | b.build().flags = Notification.FLAG_AUTO_CANCEL; |
387 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 335 | nm.notify(pc.getSessionUUID(), uid, b.build()); | ... | ... |
... | @@ -30,7 +30,7 @@ public class WarpConstants { | ... | @@ -30,7 +30,7 @@ public class WarpConstants { |
30 | /** | 30 | /** |
31 | * The version of the SDK installed in the device | 31 | * The version of the SDK installed in the device |
32 | */ | 32 | */ |
33 | - public static final String SDK_VERSION = "4.5.5.3"; | 33 | + public static final String SDK_VERSION = "4.5.5.4"; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * The URL of the server where it should ping | 36 | * The URL of the server where it should ping | ... | ... |
-
Please register or login to post a comment