Skip to content

FCM Device Token Field Blank (Android) #3099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vusimoy0 opened this issue Nov 23, 2016 · 3 comments
Closed

FCM Device Token Field Blank (Android) #3099

vusimoy0 opened this issue Nov 23, 2016 · 3 comments

Comments

@vusimoy0
Copy link

vusimoy0 commented Nov 23, 2016

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");

    }

}
@vusimoy0
Copy link
Author

managed to resolve

@EdHourani
Copy link

Can you share how you resolved this?

@anilbarnwal
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants