簡體   English   中英

我如何在城市飛艇上注冊設備

[英]how do i register device with urban airship

我正在開發將從城市飛艇接收推送通知的應用程序。 我設法得到推送通知。 目前,我已將此代碼添加到myapplication類中

       AirshipConfigOptions options = AirshipConfigOptions
            .loadDefaultOptions(Myapplication.this);
    UAirship.takeOff(this, options);
    PushManager.shared().setAlias("test");

    // Tags
    HashSet<String> tags = new HashSet<String>();
    tags.add("tag1");
    tags.add("tag2");
    PushManager.shared().setTags(tags);
    PushManager.enablePush();
    PushManager.shared().setIntentReceiver(IntentReceiver.class);
    String apid = PushManager.shared().getAPID();
    Logger.info("My Application onCreate - App APID: " + apid); 

它始終顯示“您尚未注冊任何設備令牌”。 我如何在城市飛艇上注冊設備? 誰能幫我嗎 。

試試以下代碼片段:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
UA_LINFO(@"APNS device token: %@", deviceToken);

// Updates the device token and registers the token with UA. This won't occur until
// push is enabled if the outlined process is followed. This call is required.
[[UAPush shared] registerDeviceToken:deviceToken];

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM