Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

On Android, GCMIntentService.onError() doesn't get passed to the JavaScript "error" event #65

Closed
T18970237136 opened this issue Aug 14, 2015 · 2 comments
Assignees
Milestone

Comments

@T18970237136
Copy link

Hi, this is a follow-up issue to #54.

I'm using the plugin on a android device:

var push = PushNotification.init({
    "android": { "senderID": "123456789" },
    "ios": {}, "windows": {}
});

push.on('registration', function (data) {
    alert("Token: " + data.registrationId);
});


push.on('error', function (e) {
    alert("Error: " + e.message);
});

When the device sucessfully gets a token for GCM, everything works and the alert is shown.
However when the device cannot get the token, the "error" event on the push object is not raised, so no alert is shown.

When a error occurs, the android logs show this:

D/GCMBaseIntentService( 1895): handleRegistration: registrationId = null, error = AUTHENTICATION_FAILED, unregistered = null
D/GCMBaseIntentService( 1895): Registration error: AUTHENTICATION_FAILED
E/PushPlugin_GCMIntentService( 1895): onError - errorId: AUTHENTICATION_FAILED

GCMIntentService.onError() is called, but this method only has a logging statement, so the implementation to delegate the error to the javascript push.error event seems to be missing:

    @Override
    public void onError(Context context, String errorId) {
        Log.e(LOG_TAG, "onError - errorId: " + errorId);
    }

Thanks!

@macdonst macdonst added this to the Release 1.2.0 milestone Aug 16, 2015
@macdonst macdonst self-assigned this Aug 16, 2015
macdonst added a commit that referenced this issue Aug 16, 2015
@macdonst
Copy link
Member

Fixed in master, will be part of 1.2 release.

chaffeqa added a commit to sportstech/phonegap-plugin-push that referenced this issue Aug 26, 2015
* 'master' of github.com:phonegap/phonegap-plugin-push:
  Update README
  Update CHANGELOG
  Version 1.2.0
  Issue phonegap#75: Implement Big Picture Style for Android
  Issue phonegap#74: Implement Inbox style for Android
  Issue phonegap#67: Pushes being deleted from notification bar when cold start
  Issue phonegap#62: "Actionable" Notification Buttons
  Issue phonegap#65: On Android, GCMIntentService.onError() doesn't get passed to the JavaScript 'error' event
  Group notifications and insert Html format
@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants