2014-05-21 29 views
0

我正在開發將接收來自城市飛艇的推送通知的應用程序。我設法得到推送通知。 目前我已經添加了所有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); 

它總是顯示「您沒有註冊還沒有任何設備令牌」。 我如何在城市飛艇上註冊設備?誰能幫我嗎 。

+0

城市飛艇的SDK將自動註冊設備令牌或APIDs你。我建議在這裏查看他們的示例應用程序或他們的文檔:http://docs.urbanairship.com/build/android.html和這裏:http://www.urbanairship.com/resources/developer-resources – dperconti

回答

0

試試這個片斷:

- (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]; 

}

+0

OP問關於Android ,而不是iOS。 – dperconti