本文整理匯總了Java中com.facebook.FacebookSdk.isInitialized方法的典型用法代碼示例。如果您正苦於以下問題:Java FacebookSdk.isInitialized方法的具體用法?Java FacebookSdk.isInitialized怎麽用?Java FacebookSdk.isInitialized使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.FacebookSdk
的用法示例。
在下文中一共展示了FacebookSdk.isInitialized方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!FacebookSdk.isInitialized()) {
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(getActivity().getApplication());
}
// Initialize Firebase Auth
fireBaseAuth = FirebaseAuth.getInstance();
fireBaseAuth.signOut();
facebookCallbackManager = CallbackManager.Factory.create();
registerFirebase();
registerFacebookCallback();
LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email", "public_profile"));
}
示例2: initFBSdk
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
private void initFBSdk() {
if (!FacebookSdk.isInitialized()) {
FacebookSdk.setApplicationId(ApiObjects.facebook.get("app_id"));
FacebookSdk.sdkInitialize(getActivity().getApplicationContext());
}
callbackManager = CallbackManager.Factory.create();
profileTracker = new ProfileTracker() {
@Override
protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
if (eventHandler != null) {
if (currentProfile != null)
eventHandler.onFacebookLoggedIn();
}
}
};
}
示例3: sdkInitialized
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static void sdkInitialized() {
if (!FacebookSdk.isInitialized()) {
throw new FacebookSdkNotInitializedException(
"The SDK has not been initialized, make sure to call " +
"FacebookSdk.sdkInitialize() first.");
}
}
示例4: facebookGraphRequest
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public void facebookGraphRequest() {
if (!FacebookSdk.isInitialized()) {
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(getApplication());
}
GraphRequest request = GraphRequest.newMeRequest(
//loginResult.getAccessToken(),
AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
Log.v(TAG, response.toString());
// Application code
try {
if (object == null) return;
Person person = new Person();
String name = object.getString("name");
String gender = object.getString("gender"); // 01/31/1980 format
String id = object.getString("id");
Log.d(TAG, "Name: " + name + ". Gender: " + gender);
person.setName(name);
person.setId(id);
person.setLink("http://www.facebook.com/" + id);
dataKey = mPlaceReference.push().getKey();
mPlaceReference.child(dataKey).setValue(person);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,gender,birthday");
request.setParameters(parameters);
request.executeAsync();
}
示例5: FacebookSignInProvider
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
/**
* Constuctor. Intitializes the SDK and debug logs the app KeyHash that must be set up with
* the facebook backend to allow login from the app.
*
* @param context the context.
*/
public FacebookSignInProvider(final Context context) {
if (!FacebookSdk.isInitialized()) {
Log.d(LOG_TAG, "Initializing Facebook SDK...");
FacebookSdk.sdkInitialize(context);
Utils.logKeyHash(context);
}
}
示例6: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
sharedPreferences =
((AptoideApplication) getApplicationContext()).getDefaultSharedPreferences();
if (!FacebookSdk.isInitialized()) {
FacebookSdk.sdkInitialize(getApplicationContext());
}
}
示例7: login
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public void login(Activity activity, int requestCode, Collection<String> permissions, final Callback callback) {
if (FacebookSdk.isInitialized()) {
Log.w("FacebookAuthProvider", "FacebookSDK was already initialized and we couldn't set the custom Request Code for the Login result. This may affect Android.Lock Library inner workings.");
Log.w("FacebookAuthProvider", "Either initialize the SDK with the Request Code as the callbackRequestCodeOffset, or let this provider initialize the SDK.");
} else {
FacebookSdk.sdkInitialize(activity, requestCode);
}
//Use callbackRequestCodeOffset as the requestCode because Login RC is internally defined as "offset + 0".
//see https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/main/java/com/facebook/internal/CallbackManagerImpl.java#L92
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult result) {
callback.onSuccess(result);
}
@Override
public void onCancel() {
callback.onCancel();
}
@Override
public void onError(FacebookException error) {
callback.onError(error);
}
});
LoginManager.getInstance().logInWithReadPermissions(activity, permissions);
}
示例8: logout
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public void logout() {
if (FacebookSdk.isInitialized()){
LoginManager.getInstance().logOut();
} else {
Log.w("FacebookAuthProvider", "Couldn't log out as the SDK wasn't initialized yet.");
}
}
示例9: checkInit
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static void checkInit() {
if (!FacebookSdk.isInitialized()) {
throw new RuntimeException("ReactiveFB not initialized. Are you missing " +
"ReactiveFB.sdkInitialize(context) ?");
}
}
示例10: sdkInitialized
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static void sdkInitialized() {
if (!FacebookSdk.isInitialized()) {
throw new FacebookSdkNotInitializedException();
}
}
示例11: isInitialized
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public boolean isInitialized() {
return FacebookSdk.isInitialized();
}