@@ -27,21 +27,22 @@ public OnActionsListener() {
27
27
@ Override
28
28
protected void onHandleIntent (@ Nullable Intent notificationIntent ) {
29
29
assert notificationIntent != null ;
30
- if (notificationIntent .getAction ().equals (BackgroundTask .ACTION_TEST_JME )){
31
- //start another explicit intent implicitly from an IntentService which is directed using a PendingIntent from a notification action
32
- Intent intent = new Intent (getApplication (), HolderActivity .class );
33
- //start an activity from outside the context flag
34
- intent .setFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
35
- startActivity (intent );
36
- NotificationManager notificationManager = (NotificationManager ) getApplicationContext ().getSystemService (Context .NOTIFICATION_SERVICE );
37
- notificationManager .deleteNotificationChannel (NotificationUtils .CHANNEL_ID );
38
- notificationManager .cancelAll ();
39
- Toast .makeText (getApplicationContext (), "Powered By Jme" , LENGTH_LONG ).show ();
40
- }else if (notificationIntent .getAction ().equals (BackgroundTask .ACTION_DISMISS )){
41
- NotificationManager notificationManager = (NotificationManager ) getApplicationContext ().getSystemService (Context .NOTIFICATION_SERVICE );
42
- notificationManager .deleteNotificationChannel (NotificationUtils .CHANNEL_ID );
43
- notificationManager .cancelAll ();
44
-
30
+ synchronized (this ){
31
+ if ( notificationIntent .getAction ().equals (BackgroundTask .ACTION_TEST_JME ) ){
32
+ //start another explicit intent implicitly from an IntentService which is directed using a PendingIntent from a notification action
33
+ Intent intent = new Intent (getApplication (), HolderActivity .class );
34
+ //start an activity from outside the context flag
35
+ intent .setFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
36
+ startActivity (intent );
37
+ NotificationManager notificationManager = (NotificationManager ) getApplicationContext ().getSystemService (Context .NOTIFICATION_SERVICE );
38
+ notificationManager .deleteNotificationChannel (NotificationUtils .CHANNEL_ID );
39
+ notificationManager .cancelAll ();
40
+ Toast .makeText (getApplicationContext (), "Powered By Jme" , LENGTH_LONG ).show ();
41
+ } else if ( notificationIntent .getAction ().equals (BackgroundTask .ACTION_DISMISS ) ){
42
+ NotificationManager notificationManager = (NotificationManager ) getApplicationContext ().getSystemService (Context .NOTIFICATION_SERVICE );
43
+ notificationManager .deleteNotificationChannel (NotificationUtils .CHANNEL_ID );
44
+ notificationManager .cancelAll ();
45
+ }
45
46
}
46
47
}
47
48
}
0 commit comments