模拟器中的 Tizen 推送通知 [英] Tizen Push notifications in emulator

查看:22
本文介绍了模拟器中的 Tizen 推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在模拟器中开发一个小型 Tizen Web 应用程序,因为我没有开发人员设备.

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

对于这个应用程序,我需要使用推送消息.我请求访问推送服务并且该请求获得批准.之后,我尝试注册该应用程序,如下所述:https://developer.tizen.org/documentation/articles/push-api

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);
}

然而,当我运行该代码时,我得到一个 UnknownError.

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?

无论如何,我能够从我的服务器发送推送请求,如 https://developer.tizen.org/dev-guide/2.2.0/org.tizen.native.appprogramming/html/guide/消息传递/push_server_api.htm

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

我的问题是:我错过了什么?为什么我在 Tizen 应用程序中不断收到 UnknownError?

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

推荐答案

同时添加以下权限和功能.

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.

这篇关于模拟器中的 Tizen 推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆