简体   繁体   English

如何在Tizen上显示通知

[英]How to show notification on tizen

i need to show notification on tizen. 我需要在tizen上显示通知。 i've try the below code. 我尝试下面的代码。

Tizen::Shell::NotificationManager notiMgr;
notiMgr.Construct();
NotificationRequest request;
request.SetAlertText(L"AlertText");
request.SetTitleText(L"TitleText");
request.SetAppMessage(L"AppMessage");
request.SetNotificationStyle(NOTIFICATION_STYLE_NORMAL);
notiMgr.Notify(request);

i will get notification while put this code into tizen notification example.That means this code works any form in the example.However,in my simple button click i can't.There is no error occur while click the button.But nothing happens. 在将此代码放入tizen通知示例中时,我会得到通知。这意味着该代码在示例中可以使用任何形式。但是,在我简单的按钮中单击我无法。单击该按钮没有错误。但是什么也没有发生。

As the logs say: "The application does not have the privilege to call this method." 如日志所述: “应用程序无权调用此方法。”

If you look up NotificationManager::Notify you'll see that it requires the privilege http://tizen.org/privilege/notification . 如果您查看NotificationManager :: Notify ,则会看到它需要特权http://tizen.org/privilege/notification

To request this priviledge for your app, open your manifest.xml file, click on the Privileges tab, click Add... , enter the string http://tizen.org/privilege/notification , click OK and rebuild/deploy your app. 要为您的应用程序请求此特权,请打开manifest.xml文件,单击“ Privileges选项卡,单击“ Add... ,输入字符串http://tizen.org/privilege/notification ,单击“确定”,然后重新构建/部署应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM