/** * Common processing for many notifications * * @param token * the token associated with the action being undertake * @param data * the result data */ private void simpleAction(IMqttToken token, Bundle data) { if (token != null) { Status status = (Status) data .getSerializable(MqttServiceConstants.CALLBACK_STATUS); if (status == Status.OK) { ((MqttTokenAndroid) token).notifyComplete(); } else if(status == Status.INTERMEDIATE){ ((MqttTokenAndroid) token).notifyIntermediate(); } else { Exception exceptionThrown = (Exception) data.getSerializable(MqttServiceConstants.CALLBACK_EXCEPTION); ((MqttTokenAndroid) token).notifyFailure(exceptionThrown); } } else { mqttService.traceError(MqttService.TAG, "simpleAction : token is null"); } }