Example usage for android.os Bundle toString

List of usage examples for android.os Bundle toString

Introduction

In this page you can find the example usage for android.os Bundle toString.

Prototype

@Override
    public synchronized String toString() 

Source Link

Usage

From source file:hk.edu.cityu.appslab.calmessenger.gcm.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*//from ww w.  j a  v  a 2s  . c o m
         * Filter messages based on message type. Since it is likely that
         * GCM will be extended in the future with new message types, just
         * ignore any message types you're not interested in, or that you
         * don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Error", "Send error: " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            sendNotification("Deleted", "Deleted messages on server: " + extras.toString());
            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
            Log.i(TAG, "Received: " + extras.toString());

            handleJsonMessage(extras.getString("m"));
        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}

From source file:vn.co.taxinet.mobile.gcm.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {

    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);
    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*//w w  w.j  ava  2 s  .  c  o m
         * Filter messages based on message type. Since it is likely that
         * GCM will be extended in the future with new message types, just
         * ignore any message types you're not interested in, or that you
         * don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Send error: " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            sendNotification("Deleted messages on server: " + extras.toString());
            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
            String status = intent.getStringExtra("status");

            Intent intent2 = new Intent(Constants.BroadcastAction.DISPLAY_REQUEST);
            intent2.putExtra("status", status);

            sendBroadcast(intent2);

            System.out.println(extras);
            // send notification
            sendNotification("Received: " + extras.toString());
            // show alert

            // Utils.displayRequest(context, driverImage, driverName,
            // longitude, latitude, price)
        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}

From source file:com.example.jaecheol.gcm.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*//from  ww  w .j  av  a 2  s .  c o  m
         * Filter messages based on message type. Since it is likely that GCM will be
         * extended in the future with new message types, just ignore any message types you're
         * not interested in, or that you don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Send error: " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            sendNotification("Deleted messages on server: " + extras.toString());
            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {

            //                String title = extras.getString("title");
            //                String message = extras.getString("message");
            //
            //                // This loop represents the service doing some work.
            //                for (int i = 0; i < 2; i++) {
            //                    Log.i(TAG, "Working... " + (i + 1)
            //                            + "/5 @ " + SystemClock.elapsedRealtime());
            //                    try {
            //                        Thread.sleep(2000);
            //                    } catch (InterruptedException e) {
            //                    }
            //                }
            //                Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime());
            // Post notification of received message.
            //                sendNotification("Received: " + extras.toString());
            sendNotification("Received: " + extras.getString("key1") + extras.getString("key2"));
            Log.i(TAG, "Received: " + extras.toString());

            Log.d("123", "START");
            Intent intent2 = new Intent(this.getApplicationContext(), MainActivity.class);
            intent2.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent2.putExtra("data", extras);
            //intent2.setData(Uri.parse(extras.toString()));
            startActivity(intent2);
            Log.d("123", "END");

        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}

From source file:br.com.recidev.gamethis.util.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {

    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*// w ww  .  j a v a 2  s . co  m
         * Filter messages based on message type. Since it is likely that GCM will be
         * extended in the future with new message types, just ignore any message types you're
         * not interested in, or that you don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Send error: " + extras.toString(), "", null);
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            sendNotification("Deleted messages on server: " + extras.toString(), "", null);
            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
            String tipoNotificacao = intent.getStringExtra("collapse_key");
            if (tipoNotificacao != null && !tipoNotificacao.equals("")) {

                tipoNotificacao = tipoNotificacao.substring(2);

                if (tipoNotificacao.equals("Novo Usuario")) {
                    sendNotification("Novo usurio criado com sucesso!", tipoNotificacao, extras);
                }

                if (tipoNotificacao.equals("Novo Jogo")) {
                    sendNotification("Voc foi adicionado em um Novo Jogo!", tipoNotificacao, extras);
                }

            }
        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}

From source file:com.nagravision.mediaplayer.FullscreenActivity.java

private void saveInstanceState(Bundle out) {
    Log.v(LOG_TAG, "FullscreenActivity::saveInstanceState - Enter\n");

    if (out != null) {
        Log.v(LOG_TAG, "FullscreenActivity::saveInstanceState - out = " + out.toString() + "\n");
        Log.v(LOG_TAG, "SavingSTATE: LastPosition = " + mLastPosition + "\n");
        out.putInt("LastPosition", mLastPosition);
        if (mLastPosition >= 0 && mLastPosition < MOVIES_URLS.length) {
            Log.v(LOG_TAG, "SavingSTATE: MediaPosition = " + mVideoHolder.getCurrentPosition() + "\n");
            out.putInt("MediaPosition", mVideoHolder.getCurrentPosition());
        }// www.ja  v a 2s. c o  m
    } else {
        Log.v(LOG_TAG, "Cannot save instance state: null out bundle\n");
    }
}

From source file:com.csform.android.uiapptemplate.gcm.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*// ww w  .j  av  a2  s  .  c o  m
         * Filter messages based on message type. Since it is likely that GCM will be
         * extended in the future with new message types, just ignore any message types you're
         * not interested in, or that you don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Send error: " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            sendNotification("Deleted messages on server: " + extras.toString());
            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {

            //                String title = extras.getString("title");
            //                String message = extras.getString("message");
            //
            //                // This loop represents the service doing some work.
            //                for (int i = 0; i < 2; i++) {
            //                    Log.i(TAG, "Working... " + (i + 1)
            //                            + "/5 @ " + SystemClock.elapsedRealtime());
            //                    try {
            //                        Thread.sleep(2000);
            //                    } catch (InterruptedException e) {
            //                    }
            //                }
            //                Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime());
            // Post notification of received message.
            //                sendNotification("Received: " + extras.toString());
            sendNotification("Received: " + extras.getString("key1") + extras.getString("key2"));
            Log.i(TAG, "Received: " + extras.toString());

            Log.d("123", "START");
            Intent intent2 = new Intent(this.getApplicationContext(), ClientManagementActivity.class);
            intent2.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent2.putExtra("data", extras);
            //intent2.setData(Uri.parse(extras.toString()));
            startActivity(intent2);
            Log.d("123", "END");

        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}

From source file:com.nagravision.mediaplayer.FullscreenActivity.java

private void readInstanceState(Bundle in) {
    Log.v(LOG_TAG, "FullscreenActivity::readInstanceState - Enter\n");
    if (in != null) {
        Log.v(LOG_TAG, "FullscreenActivity::readInstanceState - in = " + in.toString() + "\n");
        if (!in.isEmpty()) {
            Log.v(LOG_TAG, "Reading SavedSTATE\n");
            if (in.containsKey("LastPosition")) {
                int position = in.getInt("LastPosition");
                Log.v(LOG_TAG, "SavedSTATE: LastPosition = " + mLastPosition + "\n");
                int msec = in.getInt("MediaPosition");
                Log.v(LOG_TAG, "SavedSTATE: MediaPosition = " + msec + "\n");
                ClickItem(position, msec);
            }/*from   ww  w  .j  a  v  a 2s.c om*/
        } else {
            Log.v(LOG_TAG, "No SavedSTATE available ! Input bundle empty !\n");
        }
    } else {
        Log.v(LOG_TAG, "No SavedSTATE available ! Null Input bundle !\n");
    }
}

From source file:kookmin.cs.firstcoin.BP_order.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*/*from   ww w .jav a  2s .  c om*/
         * Filter messages based on message type. Since it is likely that
         * GCM will be extended in the future with new message types, just
         * ignore any message types you're not interested in, or that you
         * don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Send error: " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {

            sendNotification("Deleted messages on server: " + extras.toString());

            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
            // This loop represents the service doing some work.
            Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime());
            // Post notification of received message.
            sendNotification("Received: " + extras.toString());
            Log.i(TAG, "Received: " + extras.toString());
        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}

From source file:com.amazonaws.mobileconnectors.pinpoint.targeting.notification.NotificationClient.java

/**
 * Handles pinpoint GCM push messages by posting a local notification when
 * the app is in the background, or sending a local broadcast if the app is
 * in the foreground. Also on Api level 19 devices and above, if local
 * notifications have been disabled and the app is in the background, a
 * local broadcast is sent./*from   www .j a v  a  2s . com*/
 *
 * @param from         the from string received by the GCM service
 * @param data         the bundle received from the GCM service
 * @param serviceClass the class extending GCMListenerService that handles
 *                     receiving GCM messages.
 * @return {@link CampaignPushResult}.
 */
public CampaignPushResult handleGCMCampaignPush(final String from, final Bundle data,
        final Class<? extends Service> serviceClass) {
    log.info("Handling GCM Notification: " + data.toString());
    return handleCampaignPush(from, data, serviceClass, GCM_INTENT_ACTION);
}

From source file:com.jpilay.bueesclient.notifications.GcmIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    // The getMessageType() intent parameter must be the intent you received
    // in your BroadcastReceiver.
    String messageType = gcm.getMessageType(intent);

    if (!extras.isEmpty()) { // has effect of unparcelling Bundle
        /*/*  ww w  .  j av  a 2 s.com*/
         * Filter messages based on message type. Since it is likely that
         * GCM will be extended in the future with new message types, just
         * ignore any message types you're not interested in, or that you
         * don't recognize.
         */
        if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
            sendNotification("Send error: " + extras.toString());
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) {
            sendNotification("Deleted messages on server: " + extras.toString());
            // If it's a regular GCM message, do some work.
        } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {

            // Post notification of received message.
            try {
                sendNotification(extras.getString("message"));
            } catch (Exception e) {
                e.printStackTrace();
            }

            Log.i(TAG, "Received: " + extras.toString());
        }
    }
    // Release the wake lock provided by the WakefulBroadcastReceiver.
    GcmBroadcastReceiver.completeWakefulIntent(intent);
}