List of usage examples for android.os Bundle putString
public void putString(@Nullable String key, @Nullable String value)
From source file:com.facebook.login.LoginMethodHandler.java
protected void logWebLoginCompleted(String e2e) { String applicationId = loginClient.getPendingRequest().getApplicationId(); AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(loginClient.getActivity(), applicationId); Bundle parameters = new Bundle(); parameters.putString(AnalyticsEvents.PARAMETER_WEB_LOGIN_E2E, e2e); parameters.putLong(AnalyticsEvents.PARAMETER_WEB_LOGIN_SWITCHBACK_TIME, System.currentTimeMillis()); parameters.putString(AnalyticsEvents.PARAMETER_APP_ID, applicationId); appEventsLogger.logSdkEvent(AnalyticsEvents.EVENT_WEB_LOGIN_COMPLETE, null, parameters); }
From source file:com.ds.kaixin.GetFriendListTask.java
@SuppressWarnings("unchecked") protected Integer doInBackground(Object... params) { if (params == null || params.length == 0 || params.length != 6) { handler.sendEmptyMessage(Constant.RESULT_FAILED_ARG_ERR); return 0; }//from w w w. j a v a 2 s.com String start = (String) params[0]; String number = (String) params[1]; Kaixin kaixin = (Kaixin) params[2]; handler = (Handler) params[3]; resultContainer = (ArrayList<FriendInfo>) params[4]; Context context = (Context) params[5]; Bundle bundle = new Bundle(); bundle.putString("start", start); bundle.putString("num", number); bundle.putString("fields", "uid,name,gender,logo50,birthday"); try { String jsonResult = kaixin.request(context, RESTAPI_INTERFACE_GETFRIENDLIST, bundle, "GET"); if (jsonResult == null) { handler.sendEmptyMessage(Constant.RESULT_FAILED_NETWORK_ERR); } else { KaixinError kaixinError = Util.parseRequestError(jsonResult); if (kaixinError != null) { Message msg = Message.obtain(); msg.what = Constant.RESULT_FAILED_REQUEST_ERR; msg.obj = kaixinError; handler.sendMessage(msg); } else { ArrayList<FriendInfo> friendList = getFriendInfos(jsonResult); if (null != friendList) { resultContainer.addAll(friendList); } if (resultContainer.size() > 0) { handler.sendEmptyMessage(Constant.RESULT_GET_FRIENDS_OK); } else { handler.sendEmptyMessage(Constant.RESULT_GET_FRIENDS_ZERO); } } } } catch (MalformedURLException e1) { Log.e(TAG, "", e1); handler.sendEmptyMessage(Constant.RESULT_FAILED_MALFORMEDURL_ERR); } catch (JSONException e1) { Log.e(TAG, "", e1); handler.sendEmptyMessage(Constant.RESULT_FAILED_JSON_PARSE_ERR); } catch (IOException e1) { Log.e(TAG, "", e1); handler.sendEmptyMessage(Constant.RESULT_FAILED_NETWORK_ERR); } catch (Exception e1) { Log.e(TAG, "", e1); handler.sendEmptyMessage(Constant.RESULT_FAILED); } return 1; }
From source file:it.sineo.android.tileMapEditor.TileMap.java
/** * Returns a Bundle representation of this map. No transient data is stored. * /*w ww .jav a2 s .c o m*/ * @return */ public Bundle toBundle() { Bundle b = new Bundle(); b.putString("name", name); b.putInt("rows", rows); b.putInt("columns", columns); b.putFloat("scale", scale); b.putFloat("xOff", xOff); b.putFloat("yOff", yOff); for (int idxRow = 0; idxRow < rows; idxRow++) { for (int idxCol = 0; idxCol < columns; idxCol++) { if (tilePaths[idxRow][idxCol] != null) { b.putString("paths_" + idxRow + "_" + idxCol, tilePaths[idxRow][idxCol]); b.putByte("angles_" + idxRow + "_" + idxCol, tileAngles[idxRow][idxCol]); } } } return b; }
From source file:cm.aptoide.com.facebook.android.Facebook.java
/** * This function does the heavy lifting of publishing an install. * @param fb//ww w. ja va 2s. co m * @param applicationId * @param context * @throws Exception */ private static void publishInstall(final Facebook fb, final String applicationId, final Context context) throws JSONException, FacebookError, MalformedURLException, IOException { String attributionId = Facebook.getAttributionId(context.getContentResolver()); SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE); String pingKey = applicationId + "ping"; long lastPing = preferences.getLong(pingKey, 0); if (lastPing == 0 && attributionId != null) { Bundle supportsAttributionParams = new Bundle(); supportsAttributionParams.putString(APPLICATION_FIELDS, SUPPORTS_ATTRIBUTION); JSONObject supportResponse = Util.parseJson(fb.request(applicationId, supportsAttributionParams)); Object doesSupportAttribution = (Boolean) supportResponse.get(SUPPORTS_ATTRIBUTION); if (!(doesSupportAttribution instanceof Boolean)) { throw new JSONException(String.format("%s contains %s instead of a Boolean", SUPPORTS_ATTRIBUTION, doesSupportAttribution)); } if ((Boolean) doesSupportAttribution) { Bundle publishParams = new Bundle(); publishParams.putString(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT); publishParams.putString(ATTRIBUTION_KEY, attributionId); String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId); fb.request(publishUrl, publishParams, "POST"); // denote success since no error threw from the post. SharedPreferences.Editor editor = preferences.edit(); editor.putLong(pingKey, System.currentTimeMillis()); editor.commit(); } } }
From source file:com.openerp.services.MailGroupSyncService.java
public void performSync(Context context, Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { try {/* w w w . j a v a 2 s .co m*/ Intent intent = new Intent(); intent.setAction(SyncFinishReceiver.SYNC_FINISH); MailGroupDB db = new MailGroupDB(context); db.setAccountUser(OpenERPAccountManager.getAccountDetail(context, account.name)); OEHelper oe = db.getOEInstance(); if (oe != null && oe.syncWithServer(true)) { MailFollowers followers = new MailFollowers(context); OEDomain domain = new OEDomain(); domain.add("partner_id", "=", oe.getUser().getPartner_id()); domain.add("res_model", "=", db.getModelName()); if (followers.getOEInstance().syncWithServer(domain, true)) { // syncing group messages JSONArray group_ids = new JSONArray(); for (OEDataRow grp : followers.select("res_model = ? AND partner_id = ?", new String[] { db.getModelName(), oe.getUser().getPartner_id() + "" })) { group_ids.put(grp.getInt("res_id")); } Bundle messageBundle = new Bundle(); messageBundle.putString("group_ids", group_ids.toString()); messageBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); messageBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(account, MessageProvider.AUTHORITY, messageBundle); } } if (OpenERPAccountManager.currentUser(context).getAndroidName().equals(account.name)) context.sendBroadcast(intent); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.battlelancer.seriesguide.api.Action.java
/** * Serializes this {@link Action} object to a {@link android.os.Bundle} representation. */// w ww . j av a2 s . c om public Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putString(KEY_TITLE, mTitle); bundle.putString(KEY_VIEW_INTENT, (mViewIntent != null) ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null); bundle.putInt(KEY_ENTITY_IDENTIFIER, mEntityIdentifier); return bundle; }
From source file:com.rukman.emde.smsgroups.authenticator.GMSAuthenticator.java
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { Log.d(TAG, "Get Auth Token"); // If the caller requested an authToken type we don't support, then // return an error if (!authTokenType.equals(GMSApplication.AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; }// www. j a v a 2 s . c o m // Extract the username and password from the Account Manager, and ask // the server for an appropriate AuthToken. final String password = AccountManager.get(mContext).getPassword(account); if (!TextUtils.isEmpty(password)) { try { final String authToken = NetworkUtilities.authenticate(account.name, password); if (!TextUtils.isEmpty(authToken)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, GMSApplication.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } // If we get here, then we couldn't access the user's password - so we // need to re-prompt them for their credentials. We do that by creating // an intent to display our AuthenticatorActivity panel. final Intent intent = new Intent(mContext, GMSAuthenticatorActivity.class); intent.putExtra(GMSAuthenticatorActivity.PARAM_USERNAME, account.name); intent.putExtra(GMSAuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.amazon.adobepass.auth.AdobeAuthenticationActivity.java
/** * Set the corresponding extras & finish this activity * * @param throwable Contains detailed info about the cause of error. * @param category Error cause category. *//* w w w. j a v a 2 s . c o m*/ private void setResultAndReturn(Throwable throwable, String category) { Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putString(AuthenticationConstants.ERROR_CATEGORY, category); bundle.putSerializable(AuthenticationConstants.ERROR_CAUSE, throwable); setResult(RESULT_CANCELED, intent.putExtra(AuthenticationConstants.ERROR_BUNDLE, bundle)); finish(); }
From source file:com.facebook.internal.Utility.java
public static Bundle parseUrlQueryString(String queryString) { Bundle params = new Bundle(); if (!isNullOrEmpty(queryString)) { String array[] = queryString.split("&"); for (String parameter : array) { String keyValuePair[] = parameter.split("="); try { if (keyValuePair.length == 2) { params.putString(URLDecoder.decode(keyValuePair[0], UTF8), URLDecoder.decode(keyValuePair[1], UTF8)); } else if (keyValuePair.length == 1) { params.putString(URLDecoder.decode(keyValuePair[0], UTF8), ""); }/*from w w w . ja v a 2 s . co m*/ } catch (UnsupportedEncodingException e) { // shouldn't happen logd(LOG_TAG, e); } } } return params; }
From source file:com.odoo.addons.phonecall.models.CRMPhoneCalls.java
public void setReminder(int row_id) { ODataRow row = browse(row_id);//from w w w .jav a 2 s . com Date start_date = ODateUtils.createDateObject(row.getString("date"), ODateUtils.DEFAULT_FORMAT, false); Date now = new Date(); if (now.compareTo(start_date) < 0) { Bundle extra = row.getPrimaryBundleData(); extra.putString(ReminderUtils.KEY_REMINDER_TYPE, "phonecall"); if (ReminderUtils.get(mContext).resetReminder(start_date, extra)) { OValues values = new OValues(); values.put("_is_dirty", "false"); values.put("has_reminder", "true"); update(row_id, values); } } }