我需要在 tizen 上显示通知。 我试过下面的代码。
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);
将此代码放入 tizen 通知示例时,我会收到通知。这意味着此代码在示例中以任何形式工作。但是,在我的简单按钮中,我不能单击。单击按钮时没有发生错误。但是没有任何反应。
最佳答案
正如日志所说:“应用程序没有调用此方法的权限。”
如果你查找NotificationManager::Notify您会看到它需要特权 http://tizen.org/privilege/notification
。
要为您的应用请求此权限,请打开您的 manifest.xml
文件,单击 Privileges
选项卡,然后单击 Add...
,输入字符串 http://tizen.org/privilege/notification
,单击“确定”并重建/部署您的应用。
关于c++ - 如何在 tizen 上显示通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23800502/