List of usage examples for android.os Bundle toString
@Override public synchronized String toString()
From source file:wfa.com.tma.wfa.notification.WfaGcmListenerService.java
/** * Called when message is received.//www .ja va 2 s .co m * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { String message = data.getString("message"); Long employeeId = Long.parseLong(data.getString("employeeId")); Log.d(TAG, data.toString()); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + message); if (from.startsWith("/topics/")) { Log.d("notification", "message received from some topic."); } else { Log.d("notification", "normal downstream message."); } // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ sendNotification(message, employeeId); // [END_EXCLUDE] }
From source file:com.gigigo.orchextra.device.notificationpush.OrchextraGcmListenerService.java
@Override public void onMessageReceived(String from, Bundle data) { if (orchextraLogger != null && actionRecovery != null) { orchextraLogger.log("Notification Push From: " + from); orchextraLogger.log("Notification Push Message: " + data.toString()); String message = getMessageFromBundle(data); AndroidBasicAction androidBasicAction = generateAndroidNotification(message); actionRecovery.recoverAction(androidBasicAction); }/*from w w w . j a v a2 s .c o m*/ }
From source file:org.gluu.oxpush2.app.PushNotificationService.java
@Override public void onMessageReceived(String from, Bundle data) { String title = data.getString("title"); String message = data.getString("message"); if (Utils.isEmpty(title) || Utils.isEmpty(message)) { Log.e(TAG, "Get unknown push notification message: " + data.toString()); return;/*from ww w . ja v a 2 s .c om*/ } Intent intent = new Intent(this, MainActivity.class); intent.putExtra(MainActivity.QR_CODE_PUSH_NOTIFICATION_MESSAGE, message); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); sendNotification(intent, "oxPush2 authentication request", null); startActivity(intent); }
From source file:samurai.geeft.android.geeft.utilities.GCM.MyGcmListenerService.java
/** * Called when message is received./*from w w w . j av a 2 s. co m*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { Log.d(TAG, data.toString()); String message = data.getString("message"); String custom = data.getString("custom"); Log.d(TAG, custom); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + message); /** * "custom": [key,"geeftId" ,"docUserId"] */ if (from.startsWith("/topics/")) { // message received from some topic. } else { // normal downstream message. } // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ parseCostum(custom); sendNotification(message); // [END_EXCLUDE] }
From source file:in.myfootprint.myfootprint.push.MyGCMListenerService.java
/** * Called when message is received.// w ww. j av a 2 s . c o m * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { String message = data.getString("message"); Log.e(TAG, "From: " + from); Log.e(TAG, "Message: " + message); Log.e(TAG, "Data: " + data.toString()); if (from.startsWith("/topics/")) { // message received from some topic. } else { // normal downstream message. } totalMessages++; // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ updateMyActivity(getApplicationContext(), totalMessages); /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ sendNotification(message); // [END_EXCLUDE] }
From source file:com.cliqz.browser.gcm.MessageListenerService.java
/** * Called when message is received./*from w w w.j a v a 2s . c o m*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ @Override public void onMessageReceived(String from, Bundle data) { final int type = Integer.valueOf(data.getString("type", "-1")); if (type == MSG_ERROR_TYPE) { Log.e(TAG, "Invalid message format " + data.toString()); return; } final String title = data.getString("title"); final String url = data.getString("url"); final String country = data.getString("cn"); Log.i(TAG, String.format(Locale.US, "Received message with type %d title \"%s\" and url \"%s\"", type, title, url)); final int mainType = type / CATEGORY_MASK; final int subType = type % CATEGORY_MASK; switch (mainType) { case SERVICE_MESSAGE_TYPE: Log.w(TAG, "Not yet supported"); break; case NEWS_MESSAGE_TYPE: sendNewsNotification(subType, title, url, country); telemetry.sendNewsNotificationSignal(TelemetryKeys.RECEIVE, true); break; default: Log.e(TAG, String.format("Unknown message with type %d and sub-type %d", mainType, subType)); break; } }
From source file:com.example.dhaejong.acp2.MyGcmListenerService.java
/** * Called when message is received./* w w w. j a v a 2 s .co m*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { Log.d(TAG, data.toString()); String message = data.getString("message"); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + message); if (from.startsWith("/topics/")) { // message received from some topic. } else { // normal downstream message. } // [START_EXCLUDE] /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ //if(data.getString("collapse_key").equals(SystemPreferences.DATA_NOT_COLLAPSED)){ /** Respect order of inserting data into db!! * id * title * categories * description * address * price * image url * start time * end time **/ try { eventArr.add(data.getString("id")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("title")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("categories")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("description")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("address")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("price")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("image_url")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("start_timestamp")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } try { eventArr.add(data.getString("end_timestamp")); } catch (MissingResourceException e) { e.printStackTrace(); eventArr.add("null"); } Log.d(TAG, eventArr.toString()); // store into local db storeReceivedEvent(); //}else{ // Log.e(TAG, "data server pushed has collapsed"); //} // send refresh action to event listview activity Intent refreshIntent = new Intent(REFRESH_ACTION); sendBroadcast(refreshIntent); /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ try { sendNotification(message, data.getString("title")); } catch (Exception e) { e.printStackTrace(); } // [END_EXCLUDE] }
From source file:com.developers.pnp.lilly.app.DetailFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (null != mUri) { if (null != args) Log.e(LOG_TAG, "Passed args Bundle: " + args.toString()); // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(getActivity(), mUri, DETAIL_COLUMNS, null, null, null); }/*from w w w .j a v a 2s .c o m*/ return null; }
From source file:com.binil.pushnotification.GcmIntentService.java
@Override public void onMessageReceived(String from, Bundle extras) { Log.i(TAG, "from = " + from); for (String key : extras.keySet()) { Log.i(TAG, "key = " + key + ", value = " + extras.get(key)); }// ww w. ja va 2 s .c o m sendNotification(extras); Log.i(TAG, "Received: " + extras.toString()); }
From source file:com.ap.mobile.services.GCMMessageListenerService.java
/** * Called when message is received./*from w ww. j a v a 2 s. c o m*/ * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. For * Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { Log.i(TAG, "from=" + from); Log.i(TAG, "data=" + data.toString()); String notificationType = data .getString(com.ap.common.models.http.HttpStatusConstants.NOTIFICATION_PROPERTY_NOTIFICATION_TYPE); String uuid = data.getString(com.ap.common.models.http.HttpStatusConstants.NOTIFICATION_PROPERTY_UUID); String careGiverUUID = data .getString(com.ap.common.models.http.HttpStatusConstants.NOTIFICATION_PROPERTY_CARE_GIVER_UUID); String careType = data .getString(com.ap.common.models.http.HttpStatusConstants.NOTIFICATION_PROPERTY_CARETYPE); Log.d(TAG, "notificationType: " + notificationType); Log.d(TAG, "uuid: " + uuid); Log.d(TAG, "careGiverUUID: " + careGiverUUID); Log.d(TAG, "careType: " + careType); if (careType != null && careType.equals(String.valueOf(CareType.CareRecipient.getCareTypeId()))) { CommandInfo commandInfo = new CommandInfo(); commandInfo.setCommand(notificationType); commandInfo.setUuid(uuid); final Intent messageQueueIntent = new Intent(Constants.MESSAGE_COMMAND_QUEUE); messageQueueIntent.putExtra(Constants.MESSAGE_COMMAND, commandInfo); LocalBroadcastManager.getInstance(this.getApplicationContext()).sendBroadcast(messageQueueIntent); UserPreference userPreference = UserPreference.getCurrentUserPreference(this.getApplicationContext()); if (userPreference == null) { return; } Log.i(TAG, "userPreference.uuid=" + userPreference.getUuid()); Log.i(TAG, "uuid=" + uuid); if (notificationType.equalsIgnoreCase(NotificationType.START_SERVICE.name()) && uuid.equals(userPreference.getUuid())) { if (!DefaultSafeSeniorMonitorService.isRunning()) { Log.i(TAG, "DefaultSafeSeniorMonitorService is not running."); } Intent safeSeniorMonitorServiceIntent = new Intent(this.getApplicationContext(), DefaultSafeSeniorMonitorService.class); Log.i(TAG, "Starting safeSeniorServiceIntent @ " + SystemClock.elapsedRealtime()); this.getApplicationContext().startService(safeSeniorMonitorServiceIntent); } if (notificationType.equalsIgnoreCase(CommandType.CHECK_POSITION.name()) && uuid.equals(userPreference.getUuid())) { Log.i(TAG, "Checking position..."); DefaultDistanceAnalyzer distanceAnalyzer = new DefaultDistanceAnalyzer( this.getApplicationContext()); try { distanceAnalyzer.analyze(); String result = distanceAnalyzer.getDistance(); Log.i(TAG, "result=" + result); if (result == null || result.isEmpty()) { return; } if (result.startsWith(Constants.DISTANCE_SUCCESS_PREFIX)) { result = result.substring(result.indexOf(":") + 1).trim(); } UserPreference currentUserPreference = UserPreference .getCurrentUserPreference(this.getApplicationContext()); HttpNotification notification = new HttpNotification(); notification.setCreated(System.currentTimeMillis()); notification.setMessageType(NotificationType.CARE_RECEIVER_POSITION.getTypeId()); notification.setCareReceiverUUID(currentUserPreference.getUuid()); notification.setIntervalType(0); notification.setExtraInfo(result); final String url = CoreConfig.getUrl("/user/carereceiver/check_position/" + careGiverUUID); Gson gson = new Gson(); String request = gson.toJson(notification); Log.i(TAG, "distance notification=" + request); final DefaultHttpJSONClient httpClient = new DefaultHttpJSONClient(); try { httpClient.executePost(url, request); } catch (Exception e) { Log.i(TAG, "error=" + e.getMessage()); } } catch (DataAnalyzeException e) { e.printStackTrace(); } } } else { if (notificationType == null || notificationType.isEmpty()) { return; } Context context = getApplicationContext(); String notificationMainId = data .getString(HttpStatusConstants.NOTIFICATION_PROPERTY_NOTIFICATION_MAIN_ID); String created = data .getString(com.ap.common.models.http.HttpStatusConstants.NOTIFICATION_PROPERTY_CREATED); Log.i(TAG, "created=" + created); Log.i(TAG, "notificationMainId=" + notificationMainId); if (notificationType.equals(NotificationType.NOTIFICATION_DISPLAY.name())) { DataStatusOptions.isCareReceiverNotificationDirty = true; CareGiverNotificationHelper.handleInactivityNotification(data, context, created, notificationMainId); isNotificationReceived = true; } else if (notificationType.equals(NotificationType.NOTIFICATION_CLEAR.name())) { // notificationManager.cancel(NOTIFICATION_ID); // comment out this for live isNotificationReceived = false; if (!isNotificationReceived) { return; } isNotificationReceived = false; Log.i(TAG, "isNotificationOpen in CareGiverNotificationActivity=" + CareGiverNotificationActivity.isNotificationOpen); DataStatusOptions.isCareReceiverNotificationDirty = true; CareGiverNotificationHelper.handleNotificationClear(data, context, notificationMainId); } else if (notificationType.equals(NotificationType.BATTERY_LOW.name())) { Log.i(TAG, "isNotificationOpen in CareGiverNotificationActivity=" + CareGiverNotificationActivity.isNotificationOpen); DataStatusOptions.isCareReceiverNotificationDirty = true; CareGiverNotificationHelper.handleBatteryLowNotification(data, context, notificationMainId); } else if (notificationType.equals(NotificationType.CARE_RECEIVER_POSITION.name())) { DataStatusOptions.isCareReceiverNotificationDirty = true; CareGiverNotificationHelper.handleCheckPositionNotification(data, context, notificationMainId); } } }