Languages

Menu
Sites
Language
Notification triggered from the app not showing up

Platform: Gear S3 Model SR-R765A
Tizen: 2.3.2.3
The watch is not paired with a phone

I'm experimenting with the notification system from a web application and I'm running into issues where the notifications are not consistently appearing. Sometimes, the notification will show, sometimes it will not, and I'm not able to detect why. Note that I'm directly deploying the app to the watch.

Is this a known issue?

Is there anything wrong with the following setup?
- Create a sample application from TAU Basic UI template;
- Add a button with the id raiseNotification in the app;
- My app.js file has the additional code;

    var notificationButton = document.getElementById("raiseNotification");
    var page = document.getElementById("main");
    var okClickBound;

    function onClickOK(event) {
        console.log("about to raise notification");
        try {
            var notificationDict1 = {
                content : "Check the plane engine.",
                iconPath : "./icon.png",
                vibration : true,
                ledColor : "#FFFF00",
                ledOnPeriod : 1000,
                ledOffPeriod : 500
            };

            var notification1 = new tizen.StatusNotification("SIMPLE",
                    "Simple notification", notificationDict1);

            tizen.notification.post(notification1);

            console.log("notification sent from the button");
        } catch (err) {
            console.log(err.name + ": " + err.message);
        }
        return;
    }

    page.addEventListener("pagebeforeshow", function() {
        okClickBound = onClickOK.bind(null);
        notificationButton.addEventListener("click", okClickBound, false);
    });

Thanks in advance,

 

Responses

10 Replies
André Reus

hi Pascal Rapicault
Are you meaning the popup notification from top? or Showing the notification list? 
If you mean Notification list, you have to go Notification Board ( Swipe Left from Watch Face screen of your Gear) 

After calling Post function your notification should show up as popup from top. See following code

function postNotification(){
      var notification,
       notificationDict;
   try {
       // Sets notification dictionary.
       notificationDict = {
           content: "Notification Content!",
           iconPath: "../icon.png",
           vibration : true,
           ledColor : "#FFFF00",
           ledOnPeriod : 1000,
           ledOffPeriod : 500
       };
       // Creates notification object.
       notification = new tizen.StatusNotification("SIMPLE", "Notification Title", notificationDict);

       // Posts notification.
       tizen.notification.post(notification);
   } catch (err) {
       console.log(err.name + ": " + err.message);
   }
 };
 
 function init(){
	 document.querySelector("#notification-post-btn").addEventListener("click", postNotification);
 };

  init();
Pascal Rapicault

Hi André, thanks for your answer, unfortunately I'm still out of luck.
What I'm trying to do is to generate a notification that results in popup notification from the top (which also results in a blinking dot on the watch face).

I've tried the code you provided and I do get a notification to show up instantaneously, however it only shows once!?! What I mean is that if I exit the app and restart it and click on the button to generate the text, nothing happens. I've confirmed that the code is executed but the notification is not immediately displayed. In some cases, all the notifications shows but only when I restart the app, or some other app generate the app. This is really disturbing.

Because I'm going a little crazy on this, I've created a git repo to include the sample code I'm using: https://github.com/prapicault/TizenNotification

Any insight on this is welcome :)

Thanks in advance,

Pascal
 

André Reus

Please also add App Launch privilege

<tizen:privilege name="http://tizen.org/privilege/application.launch"/>

As i am seeing you have not added the privilege https://github.com/prapicault/TizenNotification/blob/master/config.xml

Pascal Rapicault

Hi André, I've added the mentioned privilege and the issue still persists. I'm really puzzled.

André Reus

Look i tried with my code and also with your github code, it works on emulator. It also works in Gear S3. 

Pascal Rapicault

I'm still getting issues with this. It works in the emulator but not consistently on the watch.
I have had some degree of success which I think is related to how the watch is connected with the phone.
I'll do further investigation and report.

Thanks for your help and time André.

 

 

Pascal Rapicault

Well after much time spent on this I finally figured it out! For notifications to be reliably shown, you need to wear the watch on your wrist, otherwise notifications are not shown. I suppose this is expected to save battery, but it would be nice if this was documented :)

Jirka Prazak

This is a setting in the Gear (now Galaxy Wearable) app on the phone. Settings -> Notification -> Show only while wearing Gear.

-J

André Reus

great news

Nagaraju Bhusani

Hi,

Can someone help me out of this issue. As I'm new to Tizen Wear web application development, and in this I'm trying to create a status notification from the app. I'm able to create the notification. Then when the user open the notification tray and trying to click on Open App then the Tizen wear app is not launching the app. And then when I try to open the app explicitely I could observe that the app loaded with the new page(home.html) which is the notification tried to launch.

Here is my code:

                 var appInfo = tizen.application.getAppInfo();

        var appCtrl = new tizen.ApplicationControl(

                'tizen.org/appcontrol/operation/create_content');        

        var notificationDict = {

            content : 'This is a simple notification.',

            iconPath : 'images/icon.png',

             soundPath: 'sounds/Beep-Once.wav',

            vibration : true,

            appControl : appCtrl,

            appId : appInfo.id

        };

        var notification = new tizen.StatusNotification('SIMPLE',

                'Simple notification', notificationDict);

        tizen.notification.post(notification);

In Congif.xml:

    <tizen:app-control>

        <tizen:src name="home.html"/>

        <tizen:operation name="tizen.org/appcontrol/operation/create_content"/>

    </tizen:app-control>

Can anyone help me out I'm using Samsung Gear S3 - 2.3.2.3 version.