Skip to content

Commit 078f4f9

Browse files
committed
Ditch Samsung specific hacks
1 parent 23c0915 commit 078f4f9

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationBackgroundThread.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public ScheduleNotificationTask(int id, Notification.Builder builder) {
2828
@Override
2929
public boolean run(Context context, Set<String> notificationIds) {
3030
String id = String.valueOf(notificationId);
31-
// are we replacing existing alarm or have capacity to schedule new one
32-
if (!(notificationIds.contains(id) || UnityNotificationManager.canScheduleMoreAlarms(notificationIds)))
33-
return false;
3431
UnityNotificationManager.mUnityNotificationManager.performNotificationScheduling(notificationId, notificationBuilder);
3532
return notificationIds.add(id);
3633
}

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationManager.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public class UnityNotificationManager extends BroadcastReceiver {
4848
protected Class mOpenActivity = null;
4949
protected UnityNotificationBackgroundThread mBackgroundThread;
5050

51-
protected static final int SAMSUNG_NOTIFICATION_LIMIT = 500;
5251
protected static final String TAG_UNITY = "UnityNotifications";
5352

5453
protected static final String KEY_FIRE_TIME = "fireTime";
@@ -359,21 +358,6 @@ protected static Intent buildOpenAppIntent(Context context, Class className) {
359358
return openAppIntent;
360359
}
361360

362-
protected static boolean canScheduleMoreAlarms(Set<String> ids) {
363-
if (ids.size() < (SAMSUNG_NOTIFICATION_LIMIT - 1))
364-
return true;
365-
if ("samsung".equals(android.os.Build.MANUFACTURER)) {
366-
// There seems to be a limit of 500 concurrently scheduled alarms on Samsung devices.
367-
// Attempting to schedule more than that might cause the app to crash.
368-
Log.w(TAG_UNITY, String.format("Attempting to schedule more than %1$d notifications. There is a limit of %1$d concurrently scheduled Alarms on Samsung devices" +
369-
" either wait for the currently scheduled ones to be triggered or cancel them if you wish to schedule additional notifications.",
370-
SAMSUNG_NOTIFICATION_LIMIT));
371-
return false;
372-
}
373-
374-
return true;
375-
}
376-
377361
protected static void performNotificationHousekeeping(Context context, Set<String> ids) {
378362
Log.d(TAG_UNITY, "Checking for invalid notification IDs still hanging around");
379363

0 commit comments

Comments
 (0)