本文整理汇总了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();
}