Parse-server: FCM Device Token Field Blank (Android)

Created on 23 Nov 2016  路  3Comments  路  Source: parse-community/parse-server

Describe your issue in as much detail as possible.

My deviceId field on parse-server is blank. I've tried putting the token in manually using code however this field is read only so am unable to fix it. The GCMSenderId field is also blank so am having to manually inject this code via code because the AndroidManifest.xml field doesnt populate this field server side

Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

  1. Create new Project via fcm, download and save google-services json and save it under root app dir. Install the rest of the firebase dependencies incl. manifest
  2. Populate the manifest with the information found on the parse server wiki page for push
  3. Start app using FCM code + Parse Server code found in android docs (ParseInstallation.getCurrentInstallation().saveInBackground(); //Push notifications). This doesnt work

Expected Results

deviceToken and GCMSenderId fields in the dashboard are supposed to be populated with the relevant info

Actual Outcome

The field remain blank

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.2.25-Beta1
    • Operating System: Ubuntu Linux 14.04
    • Hardware: DO $5 server
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Digital Ocean
  • Database

    • MongoDB version: 3.2.10
    • Storage engine: [FILL THIS OUT]
    • Hardware: Same server as parse
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Digital Ocean

Logs/Trace

Because guides dont leave a relevant log to find out what the issue is (installation gets saved) , trying to modify the value manually yields the below:

E/AndroidRuntime: FATAL EXCEPTION: pool-4-thread-1
Process: , PID: 3140
java.lang.IllegalArgumentException: Cannot modify deviceToken property of an _Installation object.

code:

private void sendRegistrationToServer(String token) {

    if(token != null) {

        final String fcmSenderId = "token";
        ParseInstallation installation = ParseInstallation.getCurrentInstallation();
        installation.put("GCMSenderId", fcmSenderId);
        installation.put("deviceToken", token);
        installation.saveInBackground();
        Log.e(LOG_TAG, "Information saved! We're good fam");

        //lets hope everything saved
    } else {
        Log.e(LOG_TAG, "failed man");

    }

}

Most helpful comment

Can you share how you resolved this?

All 3 comments

managed to resolve

Can you share how you resolved this?

If anyone is still facing this problem, please find solution here:

http://stackoverflow.com/questions/33293284/parse-error-for-updating-devicetoken-in-installation-table/41313844#41313844

Attached library is having deviceToken editable.

Was this page helpful?
0 / 5 - 0 ratings