我需要在blackberry 10级联中执行推送通知,如果我关闭应用程序意味着无法在Blackberry Hub中显示我的通知
这是代码
Button{
notification.body="hai notification testing "
notification.notify();
Notification {
id: notification
title: "Title"
}
}
当用户关闭应用程序意味着手段时,我需要在Blackberry Hub中显示通知 如何做到这一点,任何人都可以给我一些解决方案来解决这个问题。?
答案 0 :(得分:0)
这是通知代码,包括从集线器调用
Notification notification;
n.setTitle(tr("Your title"));
n.setBody(tr("your detailed description"));
n.setCategory("vibrate");
InvokeRequest request;
request.setTarget("org.xyz.yourapp.invoke");
request.setMimeType("application/vnd.yourapp");
n.setInvokeRequest(request);
n.notify();
并在条形图描述符中需要
<!-- Have an invoke entry here for when a notification is clicked on in the BlackBerry Hub -->
<!-- This will cause the application to be opened -->
<invoke-target id="org.xyz.yourapp.invoke">
<type>APPLICATION</type>
<filter>
<action>bb.action.OPEN</action>
<mime-type>application/vnd.yourapp</mime-type>
</filter>
</invoke-target>
并且不要忘记设置权限
<permission>run_when_backgrounded</permission>
<permission>post_notification</permission>