@@ -362,7 +362,7 @@ private void scheduleAlarmWithNotification(Class activityClass, Notification.Bui
362
362
mScheduledNotifications .putIfAbsent (Integer .valueOf (id ), notificationBuilder );
363
363
intent .putExtra (KEY_NOTIFICATION_ID , id );
364
364
365
- PendingIntent broadcast = getBroadcastPendingIntent (mContext , id , intent , PendingIntent .FLAG_UPDATE_CURRENT );
365
+ PendingIntent broadcast = getBroadcastPendingIntent (id , intent , PendingIntent .FLAG_UPDATE_CURRENT );
366
366
UnityNotificationManager .scheduleNotificationIntentAlarm (mContext , repeatInterval , fireTime , broadcast );
367
367
}
368
368
@@ -385,15 +385,15 @@ private Notification buildNotificationForSending(Class openActivity, Notificatio
385
385
int id = builder .getExtras ().getInt (KEY_ID , -1 );
386
386
Intent openAppIntent = buildOpenAppIntent (openActivity );
387
387
openAppIntent .putExtra (KEY_NOTIFICATION_ID , id );
388
- PendingIntent pendingIntent = getActivityPendingIntent (mContext , id , openAppIntent , 0 );
388
+ PendingIntent pendingIntent = getActivityPendingIntent (id , openAppIntent , 0 );
389
389
builder .setContentIntent (pendingIntent );
390
390
391
391
if (Build .VERSION .SDK_INT < Build .VERSION_CODES .M ) {
392
392
// Can't check StatusBar notifications pre-M, so ask to be notified when dismissed
393
393
Intent deleteIntent = new Intent (mContext , UnityNotificationManager .class );
394
394
deleteIntent .setAction (KEY_NOTIFICATION_DISMISSED ); // need action to distinguish intent from content one
395
395
deleteIntent .putExtra (KEY_NOTIFICATION_DISMISSED , id );
396
- PendingIntent deletePending = getBroadcastPendingIntent (mContext , id , deleteIntent , 0 );
396
+ PendingIntent deletePending = getBroadcastPendingIntent (id , deleteIntent , 0 );
397
397
builder .setDeleteIntent (deletePending );
398
398
}
399
399
@@ -432,7 +432,7 @@ private Set<String> findInvalidNotificationIds(Set<String> ids) {
432
432
for (String id : ids ) {
433
433
// Get the given broadcast PendingIntent by id as request code.
434
434
// FLAG_NO_CREATE is set to return null if the described PendingIntent doesn't exist.
435
- PendingIntent broadcast = getBroadcastPendingIntent (mContext , Integer .valueOf (id ), intent , PendingIntent .FLAG_NO_CREATE );
435
+ PendingIntent broadcast = getBroadcastPendingIntent (Integer .valueOf (id ), intent , PendingIntent .FLAG_NO_CREATE );
436
436
if (broadcast == null ) {
437
437
invalid .add (id );
438
438
}
@@ -471,18 +471,18 @@ private Intent buildNotificationIntent() {
471
471
return intent ;
472
472
}
473
473
474
- public static PendingIntent getActivityPendingIntent (Context context , int id , Intent intent , int flags ) {
474
+ private PendingIntent getActivityPendingIntent (int id , Intent intent , int flags ) {
475
475
if (Build .VERSION .SDK_INT >= 23 )
476
- return PendingIntent .getActivity (context , id , intent , flags | PendingIntent .FLAG_IMMUTABLE );
476
+ return PendingIntent .getActivity (mContext , id , intent , flags | PendingIntent .FLAG_IMMUTABLE );
477
477
else
478
- return PendingIntent .getActivity (context , id , intent , flags );
478
+ return PendingIntent .getActivity (mContext , id , intent , flags );
479
479
}
480
480
481
- public static PendingIntent getBroadcastPendingIntent (Context context , int id , Intent intent , int flags ) {
481
+ private PendingIntent getBroadcastPendingIntent (int id , Intent intent , int flags ) {
482
482
if (Build .VERSION .SDK_INT >= 23 )
483
- return PendingIntent .getBroadcast (context , id , intent , flags | PendingIntent .FLAG_IMMUTABLE );
483
+ return PendingIntent .getBroadcast (mContext , id , intent , flags | PendingIntent .FLAG_IMMUTABLE );
484
484
else
485
- return PendingIntent .getBroadcast (context , id , intent , flags );
485
+ return PendingIntent .getBroadcast (mContext , id , intent , flags );
486
486
}
487
487
488
488
// Save the notification intent to SharedPreferences if reschedule_on_restart is true,
@@ -585,7 +585,7 @@ public int checkNotificationStatus(int id) {
585
585
// Check if the pending notification with the given id has been registered.
586
586
public boolean checkIfPendingNotificationIsRegistered (int id ) {
587
587
Intent intent = new Intent (mActivity , UnityNotificationManager .class );
588
- return (getBroadcastPendingIntent (mContext , id , intent , PendingIntent .FLAG_NO_CREATE ) != null );
588
+ return (getBroadcastPendingIntent (id , intent , PendingIntent .FLAG_NO_CREATE ) != null );
589
589
}
590
590
591
591
// Cancel all the pending notifications.
@@ -613,7 +613,7 @@ public void cancelPendingNotification(int id) {
613
613
// Cancel a pending notification by id.
614
614
void cancelPendingNotificationIntent (int id ) {
615
615
Intent intent = new Intent (mContext , UnityNotificationManager .class );
616
- PendingIntent broadcast = getBroadcastPendingIntent (mContext , id , intent , PendingIntent .FLAG_NO_CREATE );
616
+ PendingIntent broadcast = getBroadcastPendingIntent (id , intent , PendingIntent .FLAG_NO_CREATE );
617
617
618
618
if (broadcast != null ) {
619
619
AlarmManager alarmManager = (AlarmManager ) mContext .getSystemService (Context .ALARM_SERVICE );
0 commit comments