黑莓推送通知单击主屏幕的指示区域会显示通知摘要

时间:2013-12-17 06:36:09

标签: blackberry push-notification

在努力工作后,我得到推送通知。

我想要什么

BlackBerry®单击主屏幕的指示区域会显示通知摘要。

目前正在展示

您目前没有新通知

这是我的代码

 private static void updateIndicator( int inc ) {
    ApplicationFolderIntegrationConfig config = new   ApplicationFolderIntegrationConfig(
            false, false, ApplicationDescriptor.currentApplicationDescriptor());

    //Register the ApplicationMessageFolder
    //ReadableListImpl source is available in the messagelistdemo.
    ApplicationMessageFolder folder = ApplicationMessageFolderRegistry.getInstance().registerFolder(
            0x33c7ce29883abe5fL, "Test Folder", new ReadableListImpl(), config);

    //DemoMessage source is available in the messagelistdemo.
    DemoMessage msg = new DemoMessage("me@here.com", "Pizza Toppings", 
            "What would you like on your pizza?", System.currentTimeMillis());
    folder.fireElementAdded((ApplicationMessage) msg);

    //Display the application indicator icon.

    //#ifndef HANDHELD_VERSION_42
    // update indicator if device software is 4.6 or greater
    ApplicationIndicatorRegistry indicatorRegistry = ApplicationIndicatorRegistry.getInstance();
    ApplicationIndicator indicator = indicatorRegistry.getApplicationIndicator();
    boolean refresh;
    if( indicator == null ) {
        ApplicationIcon icon = new ApplicationIcon( EncodedImage.getEncodedImageResource( "app_icon_small.png" ) );
        indicator = indicatorRegistry.register( icon, false, true );
        refresh = true;
    } else {
        refresh = inc == 0;
    }

    int unreadCount = 0;
    if( refresh ) {
        PushMessage[] messages = PersistentStorage.getMessages();
        for( int i = messages.length - 1; i >= 0; i-- ) {
            if( messages[ i ].isUnread() ) {
                unreadCount++;
            }
        }
    } else {
        unreadCount = indicator.getValue() + inc;
    }

    indicator.setValue( unreadCount );
    if( unreadCount > 0 ) {
        indicator.setVisible( true );
    } else {
        indicator.setVisible( false );
    }
    //#endif
}

我正在使用黑莓推送通知示例

我不知道我在这里做错了什么。

0 个答案:

没有答案