1

我需要在黑莓 10 级联中进行推送通知,如果我关闭应用程序意味着无法在 Blackberry Hub 中显示我的通知

这是代码

    Button{
    notification.body="hai notification testing " 
    notification.notify();
    Notification {
                    id: notification
                    title: "Title"
                }
    }

当用户关闭应用程序意味着,我需要在 Blackberry Hub 中显示通知如何做到这一点,谁能给我一些解决方案来解决这个问题。?

4

1 回答 1

0

这个问题已经在这里解决了:http: //supportforums.blackberry.com/t5/Cascades-Development/Push-Notification-in-Blackberry-Hub/mp/2186999/highlight/true#M15290

这是通知的代码,包括从集线器调用

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>
于 2013-03-03T22:05:48.120 回答