List of usage examples for org.apache.cordova DroidGap startActivityForResult
@SuppressLint("NewApi") @Override public void startActivityForResult(Intent intent, int requestCode, Bundle options)
From source file:com.facebook.android.Facebook.java
License:Apache License
/** * Internal method to handle single sign-on backend for authorize(). * * @param activity/*from w w w . j a va 2 s. co m*/ * The Android Activity that will parent the ProxyAuth Activity. * @param applicationId * The Facebook application identifier. * @param permissions * A list of permissions required for this application. If you do * not require any permissions, pass an empty String array. * @param activityCode * Activity code to uniquely identify the result Intent in the * callback. */ private boolean startSingleSignOn(Activity activity, String applicationId, String[] permissions, int activityCode) { boolean didSucceed = true; Intent intent = new Intent(); intent.setClassName("com.facebook.katana", "com.facebook.katana.ProxyAuth"); intent.putExtra("client_id", applicationId); if (permissions.length > 0) { intent.putExtra("scope", TextUtils.join(",", permissions)); } // Verify that the application whose package name is // com.facebook.katana.ProxyAuth // has the expected FB app signature. if (!validateAppSignatureForIntent(activity, intent)) { return false; } mAuthActivity = activity; mAuthPermissions = permissions; mAuthActivityCode = activityCode; try { if (this.plugin != null) { DroidGap droidgap = (DroidGap) activity; droidgap.startActivityForResult(this.plugin, intent, activityCode); } else { activity.startActivityForResult(intent, activityCode); } } catch (ActivityNotFoundException e) { didSucceed = false; } return didSucceed; }