Languages

Menu
Sites
Language
[wearable] issue receiving push notifications

Hi Guys,

 

we are trying to send and receive push notifications to an Samsung Gear S3, for testing purpose we are now testing on an Emulator.

 

We registered the Application, i added you a screenshot of your confirmation email.

 

Then we registered the app to the push service like described in the documentation (I added you the project file)

 

I added you images from the http request and the answer from the push server.

 

We are not able to receive a push notification with this setup although we can register the app.

Another question is, is there a basic setup to check connection between each station (appserver - push server - push service - application)?
Is it possible to view the notifications on the push server? to see if they are there?

 

 

 

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Arial; -webkit-text-stroke: #000000} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Arial; -webkit-text-stroke: #000000; min-height: 14.0px} span.s1 {font-kerning: none}

Edited by: John Ixion on 23 Sep, 2017

Responses

12 Replies
Armaan-Ul- Islam

Hello,

As you check Push Notification Guide and API refence

https://developer.tizen.org/development/guides/web-application/messaging/push-notification

https://developer.tizen.org/development/api-references/web-application?redirect=/dev-guide/latest/org.tizen.web.apireference/html/device_api/wearable/tizen/push.html

 

You can see there is change in Push Notification API for Tizen 2.4 & Tizen 3.0.

Gear S3 runs on Tizen 2.3.x now, so won't be an issue. But as you are testing on Emulator, please check you have not created Emulator on Tizen 3.0 platform.

Use 2.3.1 or 2.3.2 instead.

Bernhard Wytek

Hi,

thank you for your reply.
As you can see in the screenshot i added, we are using Emulator with 2.3.2.

You have any other idea?

Armaan-Ul- Islam

So, Your code is similar to the one for Tizen 2.4 & below right? You can check this matter here:

https://developer.tizen.org/forums/web-application-development/push-registration-problem.?langDirect=1

 

If that's okay, Next thing to focus would be the Connectivity. Please make sure your Emulator can be hit from external server. You may have already checked the Prequisites

            

Link: https://developer.tizen.org/development/guides/web-application/messaging/push-notification#prerequisites

 

Please make sure the emulator can access internet and port 5223. Response in this link shed some light on this issue:

http://stackoverflow.com/questions/37783743/not-able-to-connect-proxy-in-tizen-emulator/37960903#37960903

Bernhard Wytek

 

Hi,

we're doing ajax calls from the app, so i am sure we are able to connect any ip address.

We get all logs to the console, console.log('[DEBUG] Registration succeeded with id: ' + registrationId) gives back an id like
04a1e05ea549abfc390e62aab9a3e013ec693f6357e96326f18c0e40edf79d93e9eb43605163ea91d6aec9cfa072379ddb8c
with the emulator.

I think there is a problem with the connectService Method.

what do you think?

 

 


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Eco Sans Mono'} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Eco Sans Mono'; color: #3933ff} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Eco Sans Mono'; min-height: 14.0px} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Eco Sans Mono'; color: #4e9072} p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Eco Sans Mono'; color: #4f76cb} span.s1 {color: #931a68} span.s2 {color: #000000} span.s3 {color: #3933ff} span.s4 {color: #4f76cb}

window.onload = function () {

        console.log('[DEBUG] WINDOW ONLOAD');

        init();

    };

 

    var init = function () {

 

        console.log("init() called");

 

        document.addEventListener('tizenhwkey', function(e) {

 

            if(e.keyName === "back") {

 

                tizen.application.getCurrentApplication().exit();

 

            }

 

        });

 

        function notificationCallback(pushMessage)

        {

            console.log('[DEBUG] Notification received: ' + JSON.stringify(pushMessage));

 

            var appData = pushMessage.appData;

 

            $('#msg').text(appData);

        }

        

        function pushErrorCallback(error)

        {

            console.log('[DEBUG] The following error occurred: ' +  error.name);

        }

 

        function errorCallback(error)

        {

            console.log('[DEBUG] The following error occurred: ' +  error.name);

        }

 

        function registerSuccessCallback(registrationId)

        {

            console.log('[DEBUG] Registration succeeded with id: ' + registrationId);

 

            /*tizen.push.connectService(notificationCallback);*/

            tizen.push.connectService(notificationCallback, pushErrorCallback);

 

            console.log('[DEBUG] connectService');

 

            /**

             *  To get unread push notification

             */

            tizen.push.getUnreadNotifications();

 

            console.log('[DEBUG] getUnreadNotification');

 

        }

 

        var requestedAC = tizen.application.getCurrentApplication().getRequestedAppControl();

        var appAC = requestedAC.appControl;

 

        console.log('[DEBUG] appAC: ' + JSON.stringify(appAC));

        

        

        if (appAC.operation === "http://tizen.org/appcontrol/operation/push_test")

        {

            /**

             *  To get a appData from the AppControl

             */

 

            for (var i = 0; i < appAC.data.length; ++i)

            {

                if (appAC.data[i].key === 'http://tizen.org/appcontrol/data/push/appdata')

                {

                    var appData = appAC.data[i].value[0];

                    console.log('[DEBUG] value: ' + appData);

                    $('#msg').text(appData);

                }

            }

            return;

        }

 

        var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");

 

        tizen.push.registerService(service, registerSuccessCallback, errorCallback);

 

        console.log('[DEBUG] registerService');

 

    };

 

 

 





 

Armaan-Ul- Islam

I've found a sample code here and it seems your code look okay with the sample.

https://developer.tizen.org/sites/default/files/appjs.txt

 

In this post here adding 'feature' properties in config.xml is suggested.

http://stackoverflow.com/questions/23954963/tizen-push-notifications-in-emulator

Bernhard Wytek

Thanks for this suggestion.

I added the features, as you mentioned.

After receiving the Registration ID, i do not get any feedback in my logs neither an success nor an error.

Thats what makes it really difficult to understand where the problem is 

currently we would like to receive the missed push-notifications, is it possible for you to see them on the server?

 

Armaan-Ul- Islam

I'm just a Dev like you bro, ain't know nothing about the server. As far as I have seen the public documentations and Guides available your code looks okay to me, I suggest you should hit a mail to the Team now, to verify what's going wrong. Thanks. 

Check the mailing lists here:

https://www.tizen.org/community/mailing-lists

Bernhard Wytek

Sorry thought you were from Tizen dev team.
Big Thanks for your support!

Media Lab

Hi Bernhard

Have you fixed the issue?

Are you getting the push notifcations from the push server?

I am also having the similar issue with connectServer.

It would be great if you provide the solution.

Dainhan Phan

Hi Media Lab ,

me too and have you fixed the issue?

It would be great if you provide the solution.

I look forward to your response

Thank you very much

David Caicedo

Hello, I am having the same issue, get the Reg_Id but I do not receive anything from my server. I do not know how to test if the emulator can receive messages from the port 5223. Please help.

Armaan-Ul- Islam

Please make sure your Emulator can connect to Internet ( For ex: run the browser app and browse ). To receive push notification you may need 'internet' privilege and policy to access resource in your config.xml. Check this response on stack overflow for details:

https://stackoverflow.com/questions/37783743/not-able-to-connect-proxy-in-tizen-emulator/37960903#37960903

 

I have also shared a check list here on this post:

https://developer.tizen.org/forums/native-application-development/push-notifications-on-samsung-gear-s3-tizen-2.3.2.1