【问题标题】:Push notification in blackberry 10 cascades黑莓 10 级联中的推送通知
【发布时间】:2013-02-16 14:22:29
【问题描述】:

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

这里是代码

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

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

【问题讨论】:

    标签: blackberry-10


    【解决方案1】:

    这个问题已经在这里解决了:http://supportforums.blackberry.com/t5/Cascades-Development/Push-Notification-in-Blackberry-Hub/m-p/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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多