Skip to content

Local notification in IOS does'nt override with the same id #3408

@DurankGts

Description

@DurankGts

Describe the bug
Local notification in IOS does not override with the same id

To Reproduce
Utils.showNotificationOnStatusBar(1, ForceSOS.appName, serviceName, elapsetTimerEvent, 0,0, REPEAT_NONE, null, null);

Use this method that work perfectly in android

public static LocalNotification showNotificationOnStatusBar(int id, String ticker, String titleKey, String contentKey, int vibrateTime, int flashlightsTime,int repeat, String imageNameRes, String alertSoundRes){

    String methodName = "showNotificationOnStatusBar";
    LocalNotification n = null;
    try {

            try {

//getLocalizeWord
String title = getLocalizeWord(titleKey, ""+titleKey);
String content = getLocalizeWord(contentKey, ""+contentKey);
int os = Utils.getOsInt();
title = title.equals("")?ForceSOS.appName:title;
Log.i(TAG, "-------------------------------------------------------");
Log.i(TAG, "SETTING LOCAL NOTIFICATION");
Log.i(TAG, "-------------------------------------------------------");
Log.i(TAG, methodName + "()->osInt :" + os);
Log.i(TAG, methodName + "()->os :" + Utils.getOs());
Log.i(TAG, methodName + "()->id :" + id);
Log.i(TAG, methodName + "()->firtTime :" + System.currentTimeMillis());
Log.i(TAG, methodName + "()->ticker :" + ticker);
Log.i(TAG, methodName + "()->title :" + title);
Log.i(TAG, methodName + "()->content :" + content);
Log.i(TAG, methodName + "()->vibrateTime :" + vibrateTime);
Log.i(TAG, methodName + "()->flashlights :" + flashlightsTime);
Log.i(TAG, methodName + "()->imageNameRes :" + imageNameRes);
Log.i(TAG, methodName + "()->alertSoundRes:" + alertSoundRes);
Log.i(TAG, "-------------------------------------------------------");

                switch (os) {

                    case Utils.OsInt.BB:
                    case Utils.OsInt.WIN:
                    case Utils.OsInt.SIMULATOR:
                        break;

                    case Utils.OsInt.ANDROID:
                    case Utils.OsInt.IPHONE:

                        n = new LocalNotification();
                        n.setId(""+id);
                        n.setAlertTitle(title);
                        n.setAlertBody(content);

                        if (imageNameRes!=null)
                            n.setAlertImage(imageNameRes);

                        if (alertSoundRes != null)
                            n.setAlertSound(alertSoundRes);

                        if (vibrateTime > 0)
                            Display.getInstance().vibrate(vibrateTime);

                        if (flashlightsTime > 0)
                            Display.getInstance().flashBacklight(flashlightsTime);

                        Display.getInstance().scheduleLocalNotification(n, System.currentTimeMillis()+1000, repeat);
                        break;

                }

            } catch (Exception e) {
              Log.e(TAG, methodName + "()->Error1:" + LogCodes.ECatch.E1 + e.toString());
            }

    } catch (Exception e) {
        Log.e(TAG, methodName + "()->Error2:" + LogCodes.ECatch.E10 + e.toString());
    }

    return n;
}

Expected behavior
I hope that the same notification keep in toolbar not a new created

Screenshots
image

Smartphone (please complete the following information):

  • Device: iphone 6 s
  • OS:12.4.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions