如何使用适用于android和ios的钛工作室在我的通知中心内获取提醒短信



我需要在通知中心为(iOS和Android)钛应用程序显示警报消息。我正在为我的应用程序使用一个企业苹果帐户。

我可以在钛合金的后台服务模式下播放声音,但我也想在我的应用程序的通知中心看到提醒消息。

目前,我只在General -> profile -> my verified entriprise application中看到它。如何启用通知?我无法在通知中心获得提醒文本/徽章,甚至我的iPad设备中的设置中也没有应用程序设置。

此代码用于注册推送通知:

Titanium.Network.registerForPushNotifications({
    types: [
        Titanium.Network.NOTIFICATION_TYPE_BADGE,
        Titanium.Network.NOTIFICATION_TYPE_ALERT,
        Titanium.Network.NOTIFICATION_TYPE_SOUND
    ],
    success:function(e)
    {
        var deviceToken = e.deviceToken;
        label.text = "Device registered. Device token: nn"+deviceToken;
        Ti.API.info("Push notification device token is: "+deviceToken);
        Ti.API.info("Push notification types: "+Titanium.Network.remoteNotificationTypes);
        Ti.API.info("Push notification enabled: "+Titanium.Network.remoteNotificationsEnabled);
    },
    error:function(e)
    {
        label.text = "Error during registration: "+e.error;
    },
    callback:function(e)
    {
        // called when a push notification is received.
        alert("Received a push notificationnnPayload:nn"+JSON.stringify(e.data));
    }
});

如何在应用程序的通知中心部分获取通知消息?

我对您问题的假设:

  • 您想使用Appcelerator Arrow Push发送推送通知,使用https://platform.appcelerator.com
  • 您希望推送通知显示在iOS通知中心

您的代码并没有显示您实际将deviceToken发送到Arrow或任何其他发送推送通知的后端。

请遵守:https://appcelerator.github.io/appc-docs/latest/#/guide/Subscripting_to_push_notifications-section-3751717_Subscriptingpushnotifications-SubscriptingtoPushNotificationswithDeviceTokens

该应用程序无法控制推送通知的显示位置。这在iOS中通过"设置">"每个应用的通知"进行控制。

最新更新