AppStudio App push notification

195
1
Jump to solution
07-31-2019 01:19 AM
Highlighted
New Contributor III

Hi,

I have created an app using the Mapviewer template. I extended the template with some push notification functionality. When the app is used, the user get's a push notification when getting close to a feature. 

If the app is running in the background, then a push notification also appears, but this leads to this problem: 

The notification is shown on the app icon:

The notification (the number) cannot be removed again from the app icon. I have to shut the app down, before the notification disappears. 

The code for the push notification is:

            function pushNotificationMessage(title, message, vibrate) {
                if (message && notification.supported) {
                    notification.clearAll();
                    notification.schedule(title, message, 1001);
                }
                if (vibrate && Vibration.supported) {
                    Vibration.vibrate();
                }
            }

What can i do, to make the notification disappear when the app is opened?

Best Regards
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Regular Contributor

First of all, I want to make sure that we using the correct terminology here. From the code snippets, it seems that you are using the Local Notification plugin from AppStudio AppFramework, correct? 

If yes, the function clear() or clearAll() should be the one to use to clear the notification, LocalNotification QML Type | ArcGIS 

Maybe you should call that method when the app is opened? 

Thank you,

Erwin

View solution in original post

0 Kudos
1 Reply
Highlighted
Esri Regular Contributor

First of all, I want to make sure that we using the correct terminology here. From the code snippets, it seems that you are using the Local Notification plugin from AppStudio AppFramework, correct? 

If yes, the function clear() or clearAll() should be the one to use to clear the notification, LocalNotification QML Type | ArcGIS 

Maybe you should call that method when the app is opened? 

Thank you,

Erwin

View solution in original post

0 Kudos