Commit ecf103b3 authored by Simon MacDonald's avatar Simon MacDonald
Browse files

Issue #65: On Android, GCMIntentService.onError() doesn't get passed to the...

Issue #65: On Android, GCMIntentService.onError() doesn't get passed to the JavaScript 'error' event
parent 83251a2b
Loading
Loading
Loading
Loading
+4 −0
Changes for src/android/com/adobe/phonegap/push/GCMIntentService.java: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -337,6 +337,10 @@ public class GCMIntentService extends GCMBaseIntentService {
    @Override
    public void onError(Context context, String errorId) {
        Log.e(LOG_TAG, "onError - errorId: " + errorId);
        // if we are in the foreground, just send the error
        if (PushPlugin.isInForeground()) {
            PushPlugin.sendError(errorId);
        }
    }

}
 No newline at end of file
+6 −0
Changes for src/android/com/adobe/phonegap/push/PushPlugin.java: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -119,6 +119,12 @@ public class PushPlugin extends CordovaPlugin {
        pushContext.sendPluginResult(pluginResult);
    }

    public static void sendError(String message) {
        PluginResult pluginResult = new PluginResult(PluginResult.Status.ERROR, message);
        pluginResult.setKeepCallback(true);
        pushContext.sendPluginResult(pluginResult);
    }

    /*
     * Sends the pushbundle extras to the client application.
     * If the client application isn't currently active, it is cached for later processing.