@@ -651,50 +651,46 @@ public void cancelAllNotifications() {
651
651
652
652
@ Override
653
653
public void onReceive (Context context , Intent intent ) {
654
- try {
655
- if (Build .VERSION .SDK_INT < Build .VERSION_CODES .M ) {
656
- if (KEY_NOTIFICATION_DISMISSED .equals (intent .getAction ())) {
657
- int removedId = intent .getIntExtra (KEY_NOTIFICATION_DISMISSED , -1 );
658
- if (removedId > 0 ) synchronized (UnityNotificationManager .class ) {
659
- mVisibleNotifications .remove (removedId );
660
- }
661
- return ;
654
+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .M ) {
655
+ if (KEY_NOTIFICATION_DISMISSED .equals (intent .getAction ())) {
656
+ int removedId = intent .getIntExtra (KEY_NOTIFICATION_DISMISSED , -1 );
657
+ if (removedId > 0 ) synchronized (UnityNotificationManager .class ) {
658
+ mVisibleNotifications .remove (removedId );
662
659
}
660
+ return ;
663
661
}
664
- Object notification = getNotificationOrBuilderForIntent (context , intent );
665
- if (notification != null ) {
666
- Notification notif = null ;
667
- int id = -1 ;
668
- boolean sendable = notification instanceof Notification ;
669
- if (sendable ) {
670
- notif = (Notification ) notification ;
671
- id = notif .extras .getInt (KEY_ID , -1 );
672
- } else {
673
- Notification .Builder builder = (Notification .Builder )notification ;
674
- // this is different instance and does not have mOpenActivity
675
- if (builder == null ) {
676
- Log .e (TAG_UNITY , "Failed to recover builder, can't send notification" );
677
- return ;
678
- }
679
-
680
- Class openActivity ;
681
- if (mUnityNotificationManager == null || mUnityNotificationManager .mOpenActivity == null ) {
682
- openActivity = UnityNotificationUtilities .getOpenAppActivity (context , true );
683
- }
684
- else {
685
- openActivity = mUnityNotificationManager .mOpenActivity ;
686
- }
687
-
688
- id = builder .getExtras ().getInt (KEY_ID , -1 );
689
- notif = buildNotificationForSending (context , openActivity , builder );
662
+ }
663
+ Object notification = getNotificationOrBuilderForIntent (context , intent );
664
+ if (notification != null ) {
665
+ Notification notif = null ;
666
+ int id = -1 ;
667
+ boolean sendable = notification instanceof Notification ;
668
+ if (sendable ) {
669
+ notif = (Notification ) notification ;
670
+ id = notif .extras .getInt (KEY_ID , -1 );
671
+ } else {
672
+ Notification .Builder builder = (Notification .Builder )notification ;
673
+ // this is different instance and does not have mOpenActivity
674
+ if (builder == null ) {
675
+ Log .e (TAG_UNITY , "Failed to recover builder, can't send notification" );
676
+ return ;
690
677
}
691
678
692
- if (notif != null ) {
693
- UnityNotificationManager .notify (context , id , notif );
679
+ Class openActivity ;
680
+ if (mUnityNotificationManager == null || mUnityNotificationManager .mOpenActivity == null ) {
681
+ openActivity = UnityNotificationUtilities .getOpenAppActivity (context , true );
694
682
}
683
+ else {
684
+ openActivity = mUnityNotificationManager .mOpenActivity ;
685
+ }
686
+
687
+ id = builder .getExtras ().getInt (KEY_ID , -1 );
688
+ notif = buildNotificationForSending (context , openActivity , builder );
689
+ }
690
+
691
+ if (notif != null ) {
692
+ UnityNotificationManager .notify (context , id , notif );
695
693
}
696
- } catch (BadParcelableException e ) {
697
- Log .w (TAG_UNITY , e .toString ());
698
694
}
699
695
}
700
696
0 commit comments