我试图获取我的设备的令牌。想到这个:获取设备令牌?
ParseInstallation parseInstallation = new ParseInstallation();
String deviceToken = (String) parseInstallation.get("deviceToken");
会做的伎俩,但它does not,它返回null。 为什么?
我试图获取我的设备的令牌。想到这个:获取设备令牌?
ParseInstallation parseInstallation = new ParseInstallation();
String deviceToken = (String) parseInstallation.get("deviceToken");
会做的伎俩,但它does not,它返回null。 为什么?
Android设备没有稳定的唯一ID。你也许可以使用ANDROID_ID,但它会在操作系统升级/系统重置时更改
阅读此内容。希望这可以帮助。
http://android-developers.blogspot.be/2011/03/identifying-app-installations.html
OR
String android_id = Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
OR
您可以尝试获取UUID或IMEI。
OR
如果你在解析开发者控制台:
我使用这个代码,它为我的作品! 但设备令牌是未定义在解析控制台某些设备(我不知道为什么!)
String token = (String) ParseInstallation.getCurrentInstallation().get("deviceToken");
ü要设备令牌或ID? –
设备令牌,我想将它保存在数据库中,以便其他设备可以读取它并向它们发送内容。 – Philip
根据[类似的问题]('https://www.parse.com/questions/android-how-do-i-get-the-devicetoken),''get'-call应该在'Parse.initialize'之后进行。在parse.com – Peterino