Showing
8 changed files
with
112 additions
and
84 deletions
app/google-services.json
0 → 100644
1 | +{ | ||
2 | + "project_info": { | ||
3 | + "project_number": "674046222598", | ||
4 | + "project_id": "warply-sdk", | ||
5 | + "storage_bucket": "warply-sdk.appspot.com" | ||
6 | + }, | ||
7 | + "client": [ | ||
8 | + { | ||
9 | + "client_info": { | ||
10 | + "mobilesdk_app_id": "1:674046222598:android:3a7e0c274fc46ec10cbe87", | ||
11 | + "android_client_info": { | ||
12 | + "package_name": "warp.ly.android_sdk" | ||
13 | + } | ||
14 | + }, | ||
15 | + "oauth_client": [ | ||
16 | + { | ||
17 | + "client_id": "674046222598-rjlqo8cq92ctmitg8nuf7qpvlg7itddg.apps.googleusercontent.com", | ||
18 | + "client_type": 3 | ||
19 | + } | ||
20 | + ], | ||
21 | + "api_key": [ | ||
22 | + { | ||
23 | + "current_key": "AIzaSyA1dTyKyZF3ic_i0PMtk_hdYs_NaGzx4V8" | ||
24 | + } | ||
25 | + ], | ||
26 | + "services": { | ||
27 | + "appinvite_service": { | ||
28 | + "other_platform_oauth_client": [ | ||
29 | + { | ||
30 | + "client_id": "674046222598-rjlqo8cq92ctmitg8nuf7qpvlg7itddg.apps.googleusercontent.com", | ||
31 | + "client_type": 3 | ||
32 | + } | ||
33 | + ] | ||
34 | + } | ||
35 | + } | ||
36 | + } | ||
37 | + ], | ||
38 | + "configuration_version": "1" | ||
39 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -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.1' | 5 | + PUBLISH_VERSION = '4.5.5.2' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -204,20 +204,15 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -204,20 +204,15 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
204 | b.setStyle(inboxStyle); | 204 | b.setStyle(inboxStyle); |
205 | } | 205 | } |
206 | 206 | ||
207 | - b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS); | 207 | + b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND); |
208 | b.setTicker(pc.getTicker()); | 208 | b.setTicker(pc.getTicker()); |
209 | b.setChannelId(CHANNEL_ID); | 209 | b.setChannelId(CHANNEL_ID); |
210 | b.setContentTitle(pc.getTitle()); | 210 | b.setContentTitle(pc.getTitle()); |
211 | b.setContentText(pc.getSubtitle()); | 211 | b.setContentText(pc.getSubtitle()); |
212 | b.setSubText(pc.getContent()); | 212 | b.setSubText(pc.getContent()); |
213 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
214 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE)); | ||
215 | - } else { | ||
216 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT)); | ||
217 | - } | ||
218 | b.setAutoCancel(true); | 213 | b.setAutoCancel(true); |
219 | b.setOngoing(true); | 214 | b.setOngoing(true); |
220 | - b.setAutoCancel(true); | 215 | + b.setPriority(Notification.PRIORITY_MAX); |
221 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); | 216 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); |
222 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); | 217 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); |
223 | 218 | ||
... | @@ -252,23 +247,30 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -252,23 +247,30 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
252 | } | 247 | } |
253 | } | 248 | } |
254 | 249 | ||
250 | + PendingIntent pi; | ||
251 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
252 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
253 | + } else { | ||
254 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
255 | + } | ||
256 | + b.setContentIntent(pi); | ||
257 | +// b.setFullScreenIntent(pi, true); | ||
255 | 258 | ||
256 | - NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); | 259 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
257 | - | ||
258 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && nm != null) { | ||
259 | NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | 260 | NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); |
260 | - | ||
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); |
264 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); | 264 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); |
265 | // notificationChannel.enableVibration(true); | 265 | // notificationChannel.enableVibration(true); |
266 | 266 | ||
267 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
267 | nm.createNotificationChannel(notificationChannel); | 268 | nm.createNotificationChannel(notificationChannel); |
268 | Notification notification_build_with_largeicon = b.setChannelId(CHANNEL_ID).build(); | 269 | Notification notification_build_with_largeicon = b.setChannelId(CHANNEL_ID).build(); |
269 | 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 |
270 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); | 271 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); |
271 | } else { | 272 | } else { |
273 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
272 | Notification notification_build_with_largeicon = b.build(); | 274 | Notification notification_build_with_largeicon = b.build(); |
273 | 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 |
274 | if (nm != null) { | 276 | if (nm != null) { |
... | @@ -340,7 +342,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -340,7 +342,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
340 | builder.setContentIntent(pi); | 342 | builder.setContentIntent(pi); |
341 | 343 | ||
342 | NotificationManager nm = (NotificationManager) context | 344 | NotificationManager nm = (NotificationManager) context |
343 | - .getSystemService(NOTIFICATION_SERVICE); | 345 | + .getSystemService(NotificationManager.class); |
344 | Notification notification_build = builder.build(); | 346 | Notification notification_build = builder.build(); |
345 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 347 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
346 | nm.notify(tag, uid, notification_build); | 348 | nm.notify(tag, uid, notification_build); |
... | @@ -388,20 +390,15 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -388,20 +390,15 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
388 | b.setStyle(inboxStyle); | 390 | b.setStyle(inboxStyle); |
389 | } | 391 | } |
390 | 392 | ||
391 | - b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS); | 393 | + b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND); |
392 | b.setTicker(pc.getTicker()); | 394 | b.setTicker(pc.getTicker()); |
393 | b.setChannelId(CHANNEL_ID); | 395 | b.setChannelId(CHANNEL_ID); |
394 | b.setContentTitle(pc.getTitle()); | 396 | b.setContentTitle(pc.getTitle()); |
395 | b.setContentText(pc.getSubtitle()); | 397 | b.setContentText(pc.getSubtitle()); |
396 | b.setSubText(pc.getContent()); | 398 | b.setSubText(pc.getContent()); |
397 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
398 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE)); | ||
399 | - } else { | ||
400 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT)); | ||
401 | - } | ||
402 | b.setAutoCancel(true); | 399 | b.setAutoCancel(true); |
403 | b.setOngoing(true); | 400 | b.setOngoing(true); |
404 | - b.setAutoCancel(true); | 401 | + b.setPriority(Notification.PRIORITY_MAX); |
405 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); | 402 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); |
406 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); | 403 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); |
407 | 404 | ||
... | @@ -445,14 +442,13 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -445,14 +442,13 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
445 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | 442 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
446 | pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | 443 | pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); |
447 | } else { | 444 | } else { |
448 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT); | 445 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); |
449 | } | 446 | } |
450 | b.setContentIntent(pi); | 447 | b.setContentIntent(pi); |
448 | +// b.setFullScreenIntent(pi, true); | ||
451 | 449 | ||
452 | - NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); | 450 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
453 | - | 451 | + NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_HIGH); |
454 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && nm != null) { | ||
455 | - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | ||
456 | // Configure the notification channel. | 452 | // Configure the notification channel. |
457 | // notificationChannel.setDescription("Channel description"); | 453 | // notificationChannel.setDescription("Channel description"); |
458 | // notificationChannel.enableLights(true); | 454 | // notificationChannel.enableLights(true); |
... | @@ -460,11 +456,13 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { | ... | @@ -460,11 +456,13 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { |
460 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); | 456 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); |
461 | // notificationChannel.enableVibration(true); | 457 | // notificationChannel.enableVibration(true); |
462 | 458 | ||
459 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
463 | nm.createNotificationChannel(notificationChannel); | 460 | nm.createNotificationChannel(notificationChannel); |
464 | Notification notification_build = b.setChannelId(CHANNEL_ID).build(); | 461 | Notification notification_build = b.setChannelId(CHANNEL_ID).build(); |
465 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 462 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
466 | nm.notify(pc.getSessionUUID(), uid, notification_build); | 463 | nm.notify(pc.getSessionUUID(), uid, notification_build); |
467 | } else { | 464 | } else { |
465 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
468 | Notification notification_build = b.build(); | 466 | Notification notification_build = b.build(); |
469 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 467 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
470 | if (nm != null) { | 468 | if (nm != null) { | ... | ... |
... | @@ -251,20 +251,15 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -251,20 +251,15 @@ public class HMSBaseMessagingService extends HmsMessageService { |
251 | b.setStyle(inboxStyle); | 251 | b.setStyle(inboxStyle); |
252 | } | 252 | } |
253 | 253 | ||
254 | - b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS); | 254 | + b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND); |
255 | b.setTicker(pc.getTicker()); | 255 | b.setTicker(pc.getTicker()); |
256 | b.setChannelId(CHANNEL_ID); | 256 | b.setChannelId(CHANNEL_ID); |
257 | b.setContentTitle(pc.getTitle()); | 257 | b.setContentTitle(pc.getTitle()); |
258 | b.setContentText(pc.getSubtitle()); | 258 | b.setContentText(pc.getSubtitle()); |
259 | b.setSubText(pc.getContent()); | 259 | b.setSubText(pc.getContent()); |
260 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
261 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE)); | ||
262 | - } else { | ||
263 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT)); | ||
264 | - } | ||
265 | b.setAutoCancel(true); | 260 | b.setAutoCancel(true); |
266 | b.setOngoing(true); | 261 | b.setOngoing(true); |
267 | - b.setAutoCancel(true); | 262 | + b.setPriority(Notification.PRIORITY_MAX); |
268 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); | 263 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); |
269 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); | 264 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); |
270 | 265 | ||
... | @@ -298,23 +293,30 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -298,23 +293,30 @@ public class HMSBaseMessagingService extends HmsMessageService { |
298 | } | 293 | } |
299 | } | 294 | } |
300 | 295 | ||
296 | + PendingIntent pi; | ||
297 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
298 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
299 | + } else { | ||
300 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
301 | + } | ||
302 | + b.setContentIntent(pi); | ||
303 | +// b.setFullScreenIntent(pi, true); | ||
301 | 304 | ||
302 | - NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); | 305 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
303 | - | 306 | + NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_HIGH); |
304 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && nm != null) { | ||
305 | - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | ||
306 | - | ||
307 | // notificationChannel.setDescription("Channel description"); | 307 | // notificationChannel.setDescription("Channel description"); |
308 | // notificationChannel.enableLights(true); | 308 | // notificationChannel.enableLights(true); |
309 | // notificationChannel.setLightColor(color); | 309 | // notificationChannel.setLightColor(color); |
310 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); | 310 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); |
311 | // notificationChannel.enableVibration(true); | 311 | // notificationChannel.enableVibration(true); |
312 | 312 | ||
313 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
313 | nm.createNotificationChannel(notificationChannel); | 314 | nm.createNotificationChannel(notificationChannel); |
314 | Notification notification_build_with_largeicon = b.setChannelId(CHANNEL_ID).build(); | 315 | Notification notification_build_with_largeicon = b.setChannelId(CHANNEL_ID).build(); |
315 | 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 |
316 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); | 317 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); |
317 | } else { | 318 | } else { |
319 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
318 | Notification notification_build_with_largeicon = b.build(); | 320 | Notification notification_build_with_largeicon = b.build(); |
319 | 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 |
320 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); | 322 | nm.notify(pc.getSessionUUID(), uid, notification_build_with_largeicon); |
... | @@ -385,7 +387,7 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -385,7 +387,7 @@ public class HMSBaseMessagingService extends HmsMessageService { |
385 | builder.setContentIntent(pi); | 387 | builder.setContentIntent(pi); |
386 | 388 | ||
387 | NotificationManager nm = (NotificationManager) context | 389 | NotificationManager nm = (NotificationManager) context |
388 | - .getSystemService(NOTIFICATION_SERVICE); | 390 | + .getSystemService(NotificationManager.class); |
389 | Notification notification_build = builder.build(); | 391 | Notification notification_build = builder.build(); |
390 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 392 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
391 | nm.notify(tag, uid, notification_build); | 393 | nm.notify(tag, uid, notification_build); |
... | @@ -433,20 +435,15 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -433,20 +435,15 @@ public class HMSBaseMessagingService extends HmsMessageService { |
433 | b.setStyle(inboxStyle); | 435 | b.setStyle(inboxStyle); |
434 | } | 436 | } |
435 | 437 | ||
436 | - b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS); | 438 | + b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND); |
437 | b.setTicker(pc.getTicker()); | 439 | b.setTicker(pc.getTicker()); |
438 | b.setChannelId(CHANNEL_ID); | 440 | b.setChannelId(CHANNEL_ID); |
439 | b.setContentTitle(pc.getTitle()); | 441 | b.setContentTitle(pc.getTitle()); |
440 | b.setContentText(pc.getSubtitle()); | 442 | b.setContentText(pc.getSubtitle()); |
441 | b.setSubText(pc.getContent()); | 443 | b.setSubText(pc.getContent()); |
442 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
443 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE)); | ||
444 | - } else { | ||
445 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT)); | ||
446 | - } | ||
447 | b.setAutoCancel(true); | 444 | b.setAutoCancel(true); |
448 | b.setOngoing(true); | 445 | b.setOngoing(true); |
449 | - b.setAutoCancel(true); | 446 | + b.setPriority(Notification.PRIORITY_MAX); |
450 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); | 447 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); |
451 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); | 448 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); |
452 | 449 | ||
... | @@ -489,14 +486,13 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -489,14 +486,13 @@ public class HMSBaseMessagingService extends HmsMessageService { |
489 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | 486 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
490 | pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | 487 | pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); |
491 | } else { | 488 | } else { |
492 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT); | 489 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); |
493 | } | 490 | } |
494 | b.setContentIntent(pi); | 491 | b.setContentIntent(pi); |
492 | +// b.setFullScreenIntent(pi, true); | ||
495 | 493 | ||
496 | - NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); | 494 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
497 | - | 495 | + NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_HIGH); |
498 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && nm != null) { | ||
499 | - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | ||
500 | // Configure the notification channel. | 496 | // Configure the notification channel. |
501 | // notificationChannel.setDescription("Channel description"); | 497 | // notificationChannel.setDescription("Channel description"); |
502 | // notificationChannel.enableLights(true); | 498 | // notificationChannel.enableLights(true); |
... | @@ -504,11 +500,13 @@ public class HMSBaseMessagingService extends HmsMessageService { | ... | @@ -504,11 +500,13 @@ public class HMSBaseMessagingService extends HmsMessageService { |
504 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); | 500 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); |
505 | // notificationChannel.enableVibration(true); | 501 | // notificationChannel.enableVibration(true); |
506 | 502 | ||
503 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
507 | nm.createNotificationChannel(notificationChannel); | 504 | nm.createNotificationChannel(notificationChannel); |
508 | Notification notification_build = b.setChannelId(CHANNEL_ID).build(); | 505 | Notification notification_build = b.setChannelId(CHANNEL_ID).build(); |
509 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 506 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
510 | nm.notify(pc.getSessionUUID(), uid, notification_build); | 507 | nm.notify(pc.getSessionUUID(), uid, notification_build); |
511 | } else { | 508 | } else { |
509 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
512 | Notification notification_build = b.build(); | 510 | Notification notification_build = b.build(); |
513 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 511 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
514 | nm.notify(pc.getSessionUUID(), uid, notification_build); | 512 | nm.notify(pc.getSessionUUID(), uid, notification_build); | ... | ... |
... | @@ -131,20 +131,15 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -131,20 +131,15 @@ public abstract class WarpBaseIntentService extends IntentService { |
131 | b.setStyle(inboxStyle); | 131 | b.setStyle(inboxStyle); |
132 | } | 132 | } |
133 | 133 | ||
134 | - b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS); | 134 | + b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND); |
135 | b.setTicker(pc.getTicker()); | 135 | b.setTicker(pc.getTicker()); |
136 | // b.setChannelId(CHANNEL_ID); | 136 | // b.setChannelId(CHANNEL_ID); |
137 | b.setContentTitle(pc.getTitle()); | 137 | b.setContentTitle(pc.getTitle()); |
138 | b.setContentText(pc.getSubtitle()); | 138 | b.setContentText(pc.getSubtitle()); |
139 | b.setSubText(pc.getContent()); | 139 | b.setSubText(pc.getContent()); |
140 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
141 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE)); | ||
142 | - } else { | ||
143 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT)); | ||
144 | - } | ||
145 | b.setAutoCancel(true); | 140 | b.setAutoCancel(true); |
146 | b.setOngoing(true); | 141 | b.setOngoing(true); |
147 | - b.setAutoCancel(true); | 142 | + b.setPriority(Notification.PRIORITY_MAX); |
148 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); | 143 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); |
149 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); | 144 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); |
150 | 145 | ||
... | @@ -178,23 +173,30 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -178,23 +173,30 @@ public abstract class WarpBaseIntentService extends IntentService { |
178 | } | 173 | } |
179 | } | 174 | } |
180 | 175 | ||
176 | + PendingIntent pi; | ||
177 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
178 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
179 | + } else { | ||
180 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | ||
181 | + } | ||
182 | + b.setContentIntent(pi); | ||
183 | +// b.setFullScreenIntent(pi, true); | ||
181 | 184 | ||
182 | - NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); | 185 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
183 | - | 186 | + NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_HIGH); |
184 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && nm != null) { | ||
185 | - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | ||
186 | - | ||
187 | // notificationChannel.setDescription("Channel description"); | 187 | // notificationChannel.setDescription("Channel description"); |
188 | // notificationChannel.enableLights(true); | 188 | // notificationChannel.enableLights(true); |
189 | // notificationChannel.setLightColor(color); | 189 | // notificationChannel.setLightColor(color); |
190 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); | 190 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); |
191 | // notificationChannel.enableVibration(true); | 191 | // notificationChannel.enableVibration(true); |
192 | 192 | ||
193 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
193 | nm.createNotificationChannel(notificationChannel); | 194 | nm.createNotificationChannel(notificationChannel); |
194 | // Notification notification_build_with_largeicon = b.setChannelId(CHANNEL_ID).build(); | 195 | // Notification notification_build_with_largeicon = b.setChannelId(CHANNEL_ID).build(); |
195 | 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 |
196 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 197 | nm.notify(pc.getSessionUUID(), uid, b.build()); |
197 | } else { | 198 | } else { |
199 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
198 | Notification notification_build_with_largeicon = b.build(); | 200 | Notification notification_build_with_largeicon = b.build(); |
199 | 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 |
200 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 202 | nm.notify(pc.getSessionUUID(), uid, b.build()); |
... | @@ -266,7 +268,7 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -266,7 +268,7 @@ public abstract class WarpBaseIntentService extends IntentService { |
266 | builder.setContentIntent(pi); | 268 | builder.setContentIntent(pi); |
267 | 269 | ||
268 | NotificationManager nm = (NotificationManager) context | 270 | NotificationManager nm = (NotificationManager) context |
269 | - .getSystemService(NOTIFICATION_SERVICE); | 271 | + .getSystemService(NotificationManager.class); |
270 | Notification notification_build = builder.build(); | 272 | Notification notification_build = builder.build(); |
271 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; | 273 | notification_build.flags = Notification.FLAG_AUTO_CANCEL; |
272 | nm.notify(tag, uid, notification_build); | 274 | nm.notify(tag, uid, notification_build); |
... | @@ -314,20 +316,15 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -314,20 +316,15 @@ public abstract class WarpBaseIntentService extends IntentService { |
314 | b.setStyle(inboxStyle); | 316 | b.setStyle(inboxStyle); |
315 | } | 317 | } |
316 | 318 | ||
317 | - b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS); | 319 | + b.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND); |
318 | b.setTicker(pc.getTicker()); | 320 | b.setTicker(pc.getTicker()); |
319 | // b.setChannelId(CHANNEL_ID); | 321 | // b.setChannelId(CHANNEL_ID); |
320 | b.setContentTitle(pc.getTitle()); | 322 | b.setContentTitle(pc.getTitle()); |
321 | b.setContentText(pc.getSubtitle()); | 323 | b.setContentText(pc.getSubtitle()); |
322 | b.setSubText(pc.getContent()); | 324 | b.setSubText(pc.getContent()); |
323 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
324 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE)); | ||
325 | - } else { | ||
326 | - b.setContentIntent(PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT)); | ||
327 | - } | ||
328 | b.setAutoCancel(true); | 325 | b.setAutoCancel(true); |
329 | b.setOngoing(true); | 326 | b.setOngoing(true); |
330 | - b.setAutoCancel(true); | 327 | + b.setPriority(Notification.PRIORITY_MAX); |
331 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); | 328 | b.setSmallIcon(WarplyProperty.getPushIconResId(context)); |
332 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); | 329 | b.setLargeIcon(loadDrawable(pc.getImageUrl())); |
333 | 330 | ||
... | @@ -359,25 +356,18 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -359,25 +356,18 @@ public abstract class WarpBaseIntentService extends IntentService { |
359 | } | 356 | } |
360 | } | 357 | } |
361 | 358 | ||
362 | -// Notification notification_build=b.build(); | ||
363 | -// nm.notify(pc.getSessionUUID(), uid, notification_build); | ||
364 | - | ||
365 | - // Load bitmap from server and update the notification. | ||
366 | - // Do not allow sound or anything else. | ||
367 | - | ||
368 | newIntent.setAction(Long.toString(System.currentTimeMillis())); | 359 | newIntent.setAction(Long.toString(System.currentTimeMillis())); |
369 | PendingIntent pi; | 360 | PendingIntent pi; |
370 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | 361 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
371 | pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); | 362 | pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); |
372 | } else { | 363 | } else { |
373 | - pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT); | 364 | + pi = PendingIntent.getActivity(context, uid, newIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); |
374 | } | 365 | } |
375 | b.setContentIntent(pi); | 366 | b.setContentIntent(pi); |
367 | +// b.setFullScreenIntent(pi, true); | ||
376 | 368 | ||
377 | - NotificationManager nm = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); | 369 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
378 | - | 370 | + NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_HIGH); |
379 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && nm != null) { | ||
380 | - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | ||
381 | // Configure the notification channel. | 371 | // Configure the notification channel. |
382 | // notificationChannel.setDescription("Channel description"); | 372 | // notificationChannel.setDescription("Channel description"); |
383 | // notificationChannel.enableLights(true); | 373 | // notificationChannel.enableLights(true); |
... | @@ -385,11 +375,13 @@ public abstract class WarpBaseIntentService extends IntentService { | ... | @@ -385,11 +375,13 @@ public abstract class WarpBaseIntentService extends IntentService { |
385 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); | 375 | // notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); |
386 | // notificationChannel.enableVibration(true); | 376 | // notificationChannel.enableVibration(true); |
387 | 377 | ||
378 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
388 | nm.createNotificationChannel(notificationChannel); | 379 | nm.createNotificationChannel(notificationChannel); |
389 | // Notification notification_build = b.setChannelId(CHANNEL_ID).build(); | 380 | // Notification notification_build = b.setChannelId(CHANNEL_ID).build(); |
390 | b.build().flags = Notification.FLAG_AUTO_CANCEL; | 381 | b.build().flags = Notification.FLAG_AUTO_CANCEL; |
391 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 382 | nm.notify(pc.getSessionUUID(), uid, b.build()); |
392 | } else { | 383 | } else { |
384 | + NotificationManager nm = (NotificationManager) context.getSystemService(NotificationManager.class); | ||
393 | // Notification notification_build = b.build(); | 385 | // Notification notification_build = b.build(); |
394 | b.build().flags = Notification.FLAG_AUTO_CANCEL; | 386 | b.build().flags = Notification.FLAG_AUTO_CANCEL; |
395 | nm.notify(pc.getSessionUUID(), uid, b.build()); | 387 | nm.notify(pc.getSessionUUID(), uid, b.build()); | ... | ... |
... | @@ -123,7 +123,7 @@ public class WarpInAppNotificationService extends WarpBaseIntentService { | ... | @@ -123,7 +123,7 @@ public class WarpInAppNotificationService extends WarpBaseIntentService { |
123 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | 123 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
124 | pendingIntent = PendingIntent.getBroadcast(context, uid, notifyIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE); | 124 | pendingIntent = PendingIntent.getBroadcast(context, uid, notifyIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE); |
125 | } else { | 125 | } else { |
126 | - pendingIntent = PendingIntent.getBroadcast(context, uid, notifyIntent, PendingIntent.FLAG_CANCEL_CURRENT); | 126 | + pendingIntent = PendingIntent.getBroadcast(context, uid, notifyIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE); |
127 | } | 127 | } |
128 | AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); | 128 | AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); |
129 | alarmManager.cancel(pendingIntent); | 129 | alarmManager.cancel(pendingIntent); |
... | @@ -140,7 +140,7 @@ public class WarpInAppNotificationService extends WarpBaseIntentService { | ... | @@ -140,7 +140,7 @@ public class WarpInAppNotificationService extends WarpBaseIntentService { |
140 | Intent checkIntent = new Intent(context, WarplyInAppNotificationReceiver.class).putExtra(KEY_UID, uid); | 140 | Intent checkIntent = new Intent(context, WarplyInAppNotificationReceiver.class).putExtra(KEY_UID, uid); |
141 | 141 | ||
142 | // If there is an alarm already set up then returns true | 142 | // If there is an alarm already set up then returns true |
143 | - return (PendingIntent.getBroadcast(context, uid, checkIntent, PendingIntent.FLAG_NO_CREATE) != null); | 143 | + return (PendingIntent.getBroadcast(context, uid, checkIntent, PendingIntent.FLAG_NO_CREATE | PendingIntent.FLAG_IMMUTABLE) != null); |
144 | } | 144 | } |
145 | 145 | ||
146 | } | 146 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -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.1"; | 33 | + public static final String SDK_VERSION = "4.5.5.2"; |
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