android - Parse does not update deviceToken on debug app when saving current installation -
i have 2 registered accounts in parse, production , development. in native android app have 2 flavors well, production , development. each of them initializes parse on oncreate method of application right client , application keys.
when user starts app, can see in both parse installation dashboards row of installation being created. reason, on production account devicetoken gets updated , not on development one. big problem me, because if parse not set devicetoken automatically when saving current installation cannot receive push notifications on devices.
this part of code initializes parse , push notification services:
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()); } }
i save current installation when user signs or logs in :
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; } }
and part of manifest register receivers:
<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>
i use custom parsepushbroadcastreceiver in order change different notification icons among others.
the weird thing of settings in debug parse account correctly set since ios version can see devicetokens updated , can receive push notifications on development app too. assumed has problem on way register or initialize parseinstallation object, haven't been able find yet.
any ideas why not working?
Comments
Post a Comment