+ /**
+ * Implementation of <code>ResultCallback</code> that broadcasts a {@link #LOGIN_BROADCAST}
+ *
+ * @author Marius Gavrilescu
+ */
+ public final class BroadcastResultCallback implements ResultCallback{
+ /**
+ * Extra: the response message
+ */
+ public static final String EXTRA_RESPONSE_MESSAGE="response_message";
+ /**
+ * Extra: the response code
+ */
+ public static final String EXTRA_RESPONSE_CODE="response_code";
+
+ @Override
+ public void onResult(final int responseCode, final String responseMessage, final InputStream inputStream) {
+ final Intent intent=new Intent(LOGIN_BROADCAST);
+ intent.putExtra(EXTRA_RESPONSE_MESSAGE, responseMessage);
+ intent.putExtra(EXTRA_RESPONSE_CODE, responseCode);
+ sendBroadcast(intent);
+ }
+
+ @Override
+ public void onError(final String error) {
+ final Intent intent=new Intent(LOGIN_BROADCAST);
+ intent.putExtra(EXTRA_RESPONSE_MESSAGE, error);
+ sendBroadcast(intent);
+ }
+ }
+