Android 保存当前安装时,Parse不会更新调试应用程序上的deviceToken
我在Parse、production和development有两个注册帐户。在我的原生安卓应用程序中,我也有两种口味,生产和开发。它们中的每一个都使用正确的客户端和应用程序密钥初始化我的应用程序的onCreate方法上的Parse 当用户启动应用程序时,我可以在两个Parse安装仪表板中看到正在创建的安装行。但由于某些原因,只有在生产帐户上,deviceToken才得到更新,而不是在开发帐户上。这对我来说是个大问题,因为如果Parse在保存当前安装时没有自动设置deviceToken,我就无法在这些设备上接收推送通知 这是初始化解析和推送通知服务的代码部分:Android 保存当前安装时,Parse不会更新调试应用程序上的deviceToken,android,parse-platform,push-notification,Android,Parse Platform,Push Notification,我在Parse、production和development有两个注册帐户。在我的原生安卓应用程序中,我也有两种口味,生产和开发。它们中的每一个都使用正确的客户端和应用程序密钥初始化我的应用程序的onCreate方法上的Parse 当用户启动应用程序时,我可以在两个Parse安装仪表板中看到正在创建的安装行。但由于某些原因,只有在生产帐户上,deviceToken才得到更新,而不是在开发帐户上。这对我来说是个大问题,因为如果Parse在保存当前安装时没有自动设置deviceToken,我就无法在
public void init(boolean isDebug) {
try {
if(!isDebug){
Parse.initialize(context, context.getResources().getString(R.string.parse_app_id), context.getResources().getString(R.string.parse_client_key));
}
else {
Parse.initialize(context, context.getResources().getString(R.string.parse_dev_app_id), context.getResources().getString(R.string.parse_dev_client_key));
}
ParseInstallation.getCurrentInstallation().saveInBackground();
} catch (Exception exp) {
Log.d(TAG, exp.getMessage().toString());
}
}
当用户注册或登录时,我还会保存当前安装:
public boolean saveUsernameInParseInstallation()
{
ParseUser user = ParseUser.getCurrentUser();
if(user == null) return false;
else
{
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("user",user.getUsername());
installation.saveInBackground();
return true;
}
}
这是舱单上我登记所有接收人的部分:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name=".utils.Parse.MyParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.myapp.cam"/>
</intent-filter>
</receiver>
我使用自定义的ParsePushBroadcastReceiver来更改不同的通知图标
所有这一切的奇怪之处在于,调试解析帐户中的所有设置都设置正确,因为iOS版本可以看到他们的deviceTokens更新,他们也可以在开发应用程序上接收推送通知。所以我假设在注册或初始化ParseInstallation对象的过程中会出现问题,但是我还没有找到它
你知道为什么这不起作用吗?你有什么登录流程吗?我只能在用户登录时保存deviceToken。是的,我允许用户使用fb、twitter、emaill和密码登录这两种版本。即使在登录并使用新的ParseUser对象保存当前安装后,它也不会更新deviceToken::根据我的经验,Parse通常不会在服务器端保存设备令牌。目前还不确定为什么不能,但这是一个没有意义的问题,因为他们有自己的图书馆。