2016-08-21 65 views
3

我已經構建了一個Trigger.io應用程序,並且一直在使用我的推送通知的解析。如何從解析安裝檢索設備令牌

我現在正在爲推送通知需求遷移到pushwoosh,但是我意識到解析使用安裝ID來推送通知,但pushwoosh使用設備令牌。

我無法從解析中檢索設備標記,因爲可用函數只允許我檢索installtion標識。

forge.parse.installationInfo(function (info) { 
    //info object only stores the installation id 
    forge.logging.info("installation: "+JSON.stringify(info)); 
}); 

然而,對於pushwoosh,我需要從服務器端的設備ID,推動信息給特定設備

//Notify some devices or a device: 
Pushwoosh.notify_devices(message, devices, other_options) 

所以我的問題是在我從遷移我的數據解析到pushwoosh ,我如何檢索所有舊用戶的所有設備令牌,以便我可以向正在使用解析通知的用戶發送通知消息?

回答

1

對於Android,您可以通過下面的驗證碼獲得devicetokenTrigger.io在其API中沒有相同的JavaScript包裝。你可以爲你的目的而建造它。

ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() { 
    @Override 
    public void done(ParseException e) { 
     String deviceToken = (String) ParseInstallation.getCurrentInstallation().get("deviceToken"); 
    } 
}); 
+0

@ Zhen有幫助嗎? –