List of usage examples for android.os Bundle keySet
public Set<String> keySet()
From source file:com.chilliworks.chillisource.core.GCMService.java
@Override protected void onMessage(Context context, Intent intent) { HashMap<String, String> params = new HashMap<String, String>(); Bundle extras = intent.getExtras(); Set<String> keySet = extras.keySet(); for (String strKey : keySet) { params.put(strKey, extras.getString(strKey)); }//w ww. j a v a2s . co m generateNotification(context, params); }
From source file:com.maxxsol.doktorderki.gcm.COGcmListenerService.java
/** * Called when message is received.//from www. java 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 consultId = data.getString("consultId"); Log.d(TAG, "From: " + from); Log.d(TAG, "Message: " + consultId); for (String key : data.keySet()) { Log.d("Bundle Debug", key + " = \"" + data.get(key) + "\""); } sendNotification(consultId); /*if (from.startsWith("/topics/")) { // message received from some topic. } else { // normal downstream message. }*/ // [START_EXCLUDE] // [END_EXCLUDE] }
From source file:com.OpenSource.engine.connectivity.ConnectivityInfoProvider.java
private void debugIntent(Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { for (String key : extras.keySet()) { }/*from w ww . ja va2s . com*/ } else { } }
From source file:com.grouzen.android.serenity.HttpConnection.java
private ArrayList<NameValuePair> convertParams(Bundle params) { ArrayList<NameValuePair> entity = new ArrayList<NameValuePair>(); for (String k : params.keySet()) { entity.add(new BasicNameValuePair(k, params.getString(k))); }//from www . j av a 2s .c o m return entity; }
From source file:dev.ronlemire.data.ListViewFragment.java
@Override public void onCreate(Bundle bundle) { Log.v(ListViewFragment.TAG, "in ListViewFragment onCreate. Bundle contains:"); if (bundle != null) { for (String key : bundle.keySet()) { Log.v(ListViewFragment.TAG, " " + key); }/*ww w. ja v a 2 s .c o m*/ } else { Log.v(ListViewFragment.TAG, " myBundle is null"); } super.onCreate(bundle); if (bundle != null) { // Restore last state for checked position. mCurCheckPosition = bundle.getInt("curChoice", 0); } }
From source file:com.arthackday.killerapp.GCMIntentService.java
@Override protected void onMessage(Context ctxt, Intent message) { Log.i("REMOVE BEFORE COMMIT", "blahhhhhhh GCMessage"); Bundle extras = message.getExtras(); /*/*from ww w . ja va 2s . c o m*/ * TO DO! CHANGE WHAT THE MESSAGES DO!! */ for (String key : extras.keySet()) { Log.i(getClass().getSimpleName(), String.format("onMessage: %s=%s", key, extras.getString(key))); if (key.equals(KillerConstants.EXTRA_KEY_AUDIO)) { Log.i("REMOVE BEFORE COMMIT", "blahhhhhhh pushAudio"); Intent i = new Intent(); Log.i("REMOVE BEFORE COMMIT", extras.getString(key)); Bundle bundle = new Bundle(); //Add your data to bundle bundle.putString(KillerConstants.EXTRA_KEY_AUDIO, extras.getString(key)); //Add the bundle to the intent i.putExtras(bundle); i.setClassName("com.arthackday.killerapp", "com.arthackday.killerapp.PushAudio"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } if (key.equals(KillerConstants.EXTRA_KEY_PUSHCALL)) { Log.i("REMOVE BEFORE COMMIT", "blahhhhhhh callnumber"); String number = extras.getString(KillerConstants.EXTRA_KEY_PUSHCALL); String uri = "tel:" + number.trim(); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } }
From source file:com.google.firebase.quickstart.fcm.MainActivity.java
private void logIntent(Intent intent, String title) { Log.d(TAG, String.format("%s: %s", title, intent)); if (intent.getExtras() != null) { Bundle extras = intent.getExtras(); String msg = ""; for (String key : extras.keySet()) { Object value = extras.get(key); if (msg.isEmpty()) { msg = String.format("Key: %s Value: %s", key, value); } else { msg = String.format("%s\nKey: %s Value: %s", msg, key, value); }/* ww w. j a v a2 s . c o m*/ } Log.d(TAG, String.format("%s (extras):\n%s", title, msg)); } }
From source file:dev.ronlemire.data.ListViewFragment.java
@Override public void onActivityCreated(Bundle bundle) { Log.v(ListViewFragment.TAG, "in ListViewFragment onActivityCreated. bundle contains:"); if (bundle != null) { for (String key : bundle.keySet()) { Log.v(ListViewFragment.TAG, " " + key); }// w ww . j av a 2s . c o m } else { Log.v(ListViewFragment.TAG, " bundle is null"); } super.onActivityCreated(bundle); refresh(mCurCheckPosition); }
From source file:com.kakao.authorization.accesstoken.GetterAccessToken.java
private BoundRequestBuilder makeAccessTokenRequest() { final BoundRequestBuilder requestBuilder = HttpRequestTask.ASYNC_HTTP_CLIENT.preparePost( HttpRequestTask.createBaseURL(ServerProtocol.AUTH_AUTHORITY, ServerProtocol.ACCESS_TOKEN_PATH)); final Entry<String, String> entry = HttpRequestTask.KA_HEADER.entrySet().iterator().next(); requestBuilder.addHeader(entry.getKey(), entry.getValue()); if (accessTokenRequest.isAccessTokenRequestWithAuthCode()) { requestBuilder.addQueryParameter(ServerProtocol.GRANT_TYPE_KEY, ServerProtocol.GRANT_TYPE_AUTHORIZATION_CODE); requestBuilder.addQueryParameter(ServerProtocol.CODE_KEY, accessTokenRequest.getAuthorizationCode()); requestBuilder.addQueryParameter(ServerProtocol.REDIRECT_URI_KEY, accessTokenRequest.getRedirectURI()); } else { //if(request.isAccessTokenRequestWithRefreshToken()) { requestBuilder.addQueryParameter(ServerProtocol.GRANT_TYPE_KEY, ServerProtocol.REFRESH_TOKEN_KEY); requestBuilder.addQueryParameter(ServerProtocol.REFRESH_TOKEN_KEY, accessTokenRequest.getRefreshToken()); }//from ww w . jav a2 s . com requestBuilder.addQueryParameter(ServerProtocol.CLIENT_ID_KEY, accessTokenRequest.getAppKey()); requestBuilder.addQueryParameter(ServerProtocol.ANDROID_KEY_HASH, accessTokenRequest.getKeyHash()); final Bundle extraParams = accessTokenRequest.getExtras(); if (extraParams != null && !extraParams.isEmpty()) { for (String key : extraParams.keySet()) { String value = extraParams.getString(key); if (value != null) { requestBuilder.addQueryParameter(key, value); } } } return requestBuilder; }
From source file:com.google.firebase.quickstart.fcm.MainActivity.java
private void updateDataTextView(Intent intent) { logDataTextView("BEFORE UPDATE"); restoreDataTextView();/*from w ww . j a v a 2 s . c o m*/ if (intent != null && intent.getExtras() != null) { Bundle extras = intent.getExtras(); String msg = ""; for (String key : extras.keySet()) { Object value = extras.get(key); if (key.equalsIgnoreCase("google.sent_time") || key.equalsIgnoreCase("from") || key.equalsIgnoreCase("google.message_id") || key.equalsIgnoreCase("collapse_key")) { Log.d(TAG, String.format("Ignored key: %s Value: %s", key, value)); } else { if (msg.isEmpty()) { msg = String.format("Key: %s Value: %s", key, value); } else { msg = String.format("%s\nKey: %s Value: %s", msg, key, value); } } } Log.d(TAG, String.format("Generated message:\n%s", msg)); TextView dataTextView = (TextView) findViewById(R.id.dataTextView); String currentText = (String) dataTextView.getText(); if (currentText.contains("Notification message should be displayed here...")) { dataTextView.setText(msg); } else { dataTextView.setText(String.format("%s\n%s", currentText, msg)); } } saveDataTextView(); logDataTextView("AFTER UPDATE"); }