我正在尝试获取我的设备的令牌。考虑到这一点:
ParseInstallation parseInstallation = new ParseInstallation();
String deviceToken = (String) parseInstallation.get("deviceToken");
使用该方法应该可以解决问题,但实际上并没有,它返回了null。为什么呢?
我正在尝试获取我的设备的令牌。考虑到这一点:
ParseInstallation parseInstallation = new ParseInstallation();
String deviceToken = (String) parseInstallation.get("deviceToken");
使用该方法应该可以解决问题,但实际上并没有,它返回了null。为什么呢?
阅读此文,希望对您有所帮助。
http://android-developers.blogspot.be/2011/03/identifying-app-installations.html
或者
String android_id = Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
或者
你可以尝试获取UUID或IMEI。
或者
如果您在Parse开发人员控制台上:
Android设备不存在稳定的唯一标识符。你或许可以使用ANDROID_ID,但是它会在操作系统升级或系统重置时发生变化。
String token = (String) ParseInstallation.getCurrentInstallation().get("deviceToken");
get
调用应在Parse.initialize
之后进行。 - Peterino