Tizen Push notifications in emulator

偶尔善良 提交于 2019-12-06 05:37:17

问题


I'm currently developing a small Tizen web application in the emulator as I don't have a developer device.

For this application I need to use push messaging. I requested access to the push service and that request was approved. After that I tried to register the application, as described here: https://developer.tizen.org/documentation/articles/push-api

I've added the following privilige and the access origin, as it's stated in the guide:

<tizen:privilege name="http://tizen.org/privilege/push"/>
<access origin="https://euwest.push.samsungosp.com:8088" subdomains="true"/>

After that I've added the following code, which is taken from that same guide as well:

// Defines the data to be used when this process is launched by notification service.
var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");

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

function registerSuccessCallback(id)
{
    console.log("Registration succeeded with id: " + id);
}

function errorCallback(response)
{
    console.log( 'The following error occurred: ' +  response.name);
}

However, when I run that code, I get an UnknownError.

I'm starting to think it might be because I'm using an emulator. I did see that there's a push server for emulators, do I need to request access to that server instead of the EU server for it to work in an emulator?

For what it's worth, I was able to send a push request from my server, as described in https://developer.tizen.org/dev-guide/2.2.0/org.tizen.native.appprogramming/html/guide/messaging/push_server_api.htm

My question is: what am I missing? Why do I keep getting the UnknownError in the Tizen application?


回答1:


Add the below privilege and features also.

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

<feature name="http://tizen.org/feature/network.push"/>
<feature name="http://tizen.org/feature/network.wifi"/>

I also faced the same issue but got it resolved by adding above privileges and features.

i have working sample for this if you want i can give it to you.



来源:https://stackoverflow.com/questions/23954963/tizen-push-notifications-in-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!