Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: None  |  size: 2.05 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. android how to open facebook app if it is installed in the phone
  2. /*
  3.     * Copyright 2010 Facebook, Inc.
  4.     *
  5.     * Licensed under the Apache License, Version 2.0 (the "License");
  6.     * you may not use this file except in compliance with the License.
  7.     * You may obtain a copy of the License at
  8.     *
  9.     * http://www.apache.org/licenses/LICENSE-2.0
  10.     *
  11.     * Unless required by applicable law or agreed to in writing, software
  12.     * distributed under the License is distributed on an "AS IS" BASIS,
  13.     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.     * See the License for the specific language governing permissions and
  15.     * limitations under the License.
  16.     */
  17. public class Facebook {
  18. ...
  19.  
  20.         /**
  21.         * Internal method to handle single sign-on backend for authorize().
  22.         */
  23.             private boolean startSingleSignOn(Activity activity, String applicationId,
  24.                     String[] permissions, int activityCode) {
  25.                 boolean didSucceed = true;
  26.                 Intent intent = new Intent();
  27.  
  28.                 intent.setClassName("com.facebook.katana",
  29.                         "com.facebook.katana.ProxyAuth");
  30.                 intent.putExtra("client_id", applicationId);
  31.                 if (permissions.length > 0) {
  32.                     intent.putExtra("scope", TextUtils.join(",", permissions));
  33.                 }
  34.  
  35.                 // Verify that the application whose package name is
  36.                 // com.facebook.katana.ProxyAuth
  37.                 // has the expected FB app signature.
  38.                 if (!validateAppSignatureForIntent(activity, intent)) {
  39.                     return false;
  40.                 }
  41.  
  42.                 mAuthActivity = activity;
  43.                 mAuthPermissions = permissions;
  44.                 mAuthActivityCode = activityCode;
  45.                 try {
  46.                     activity.startActivityForResult(intent, activityCode);
  47.                 } catch (ActivityNotFoundException e) {
  48.                     didSucceed = false;
  49.                 }
  50.  
  51.                 return didSucceed;
  52.             }
  53. ...
  54. }