本文整理匯總了Java中com.facebook.FacebookSdk.sdkInitialize方法的典型用法代碼示例。如果您正苦於以下問題:Java FacebookSdk.sdkInitialize方法的具體用法?Java FacebookSdk.sdkInitialize怎麽用?Java FacebookSdk.sdkInitialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.FacebookSdk
的用法示例。
在下文中一共展示了FacebookSdk.sdkInitialize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
}
};
}
示例2: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.CRASH_REPORTS) {
Fabric.with(this, new Crashlytics());
}
INSTANCE = this;
// if(LeakCanary.isInAnalyzerProcess(this))
// return;
// LeakCanary.install(this);
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
UserToken.getInstance().initSharedPreferences(this);
}
示例3: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
if(AppController.USER_ID != null && AppController.USER_TOKEN != null) {
new CountDownTimer(1000, 100) {
public void onTick(long millisUntilFinished) { }
public void onFinish() {
goActivityMain();
}
}.start();
} else {
changeToLoginView();
}
pref = getSharedPreferences(CONST.PREF_NAME, MODE_PRIVATE);
editor = pref.edit();
}
示例4: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(this.getApplicationContext());
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);
shareDialog.registerCallback(
callbackManager,
shareCallback);
// Can we present the share dialog for regular links?
canPresentShareDialog = ShareDialog.canShow(
ShareLinkContent.class);
// Can we present the share dialog for photos?
canPresentShareDialogWithPhotos = ShareDialog.canShow(
SharePhotoContent.class);
}
示例5: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
mContext = getApplicationContext();
mAppHelper = new AppHelper();
FacebookSdk.sdkInitialize(getApplicationContext());
initScreenSize();
if (Config.IS_DEBUG_MODE) {
mAppHelper.showKeyHash();
mAppHelper.showSHA1Key();
}
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
// .setDefaultFontPath("fonts/Roboto-RobotoRegular.ttf")
.setFontAttrId(R.attr.fontPath)
.build());
}
示例6: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getActivity());
loginManager = LoginManager.getInstance();
callbackManager = CallbackManager.Factory.create();
mActivity = getActivity();
mContext = getActivity().getApplicationContext();
//Google
mGoogleApiClient = new GoogleApiClient.Builder(mContext)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(new Scope(Scopes.PROFILE))
.build();
}
示例7: init
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public static void init() {
FacebookConnect.implClass = FacebookImpl.class;
permissions = new ArrayList<String>();
String permissionsStr = Display.getInstance().getProperty("facebook_permissions", "");
permissionsStr = permissionsStr.trim();
StringTokenizer token = new StringTokenizer(permissionsStr, ", ");
if (token.countTokens() > 0) {
try {
while (token.hasMoreElements()) {
String permission = (String) token.nextToken();
permission = permission.trim();
permissions.add(permission);
}
} catch (Exception e) {
//the pattern is not valid
}
}
FacebookSdk.sdkInitialize(AndroidNativeUtil.getContext().getApplicationContext());
}
示例8: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.select_domain);
TextView server = (TextView) findViewById(R.id.textView_server_url);
url = getIntent().getStringExtra("server");
server.setText(url);
callbackManager = CallbackManager.Factory.create();
findViewById(R.id.button_domain_google).setOnClickListener(this);
((SignInButton) findViewById(R.id.button_domain_google)).setSize(SignInButton.SIZE_WIDE);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(new Scope(Scopes.PROFILE))
.addScope(new Scope(Scopes.EMAIL))
.build();
}
示例9: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate()
{
super.onCreate();
Parse.initialize(new Parse.Configuration.Builder(this).applicationId(getResources().getString(R.string.app_id)).clientKey(getResources().getString(R.string.client_key)).server("https://parseapi.back4app.com").build());
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("GCMSenderId", "644469506430");
installation.saveInBackground();
FacebookSdk.sdkInitialize(this);
printHashkey();
nitems.add(new NavigationItem(R.drawable.search, "Search"));
nitems.add(new NavigationItem(R.drawable.recent,"Recent"));
nitems.add(new NavigationItem(R.drawable.npost,"Post"));
litems.add(new NavigationItem(R.drawable.myposts, "My Posts"));
//litems.add(new NavigationItem(R.drawable.star,"My Bookmarks"));
}
示例10: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
Paper.init(this);
CrashHandler.getInstance().init(this);
ImageUtil.init(this);
NetworkUtil.init(this);
ConfigUtil.init(this);
TextToast.init(this);
//Facebook分享初始化
FacebookSdk.sdkInitialize(getApplicationContext());
//友盟意見反饋初始化
FeedbackPush.getInstance(this).init(false);
}
示例11: init
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
public void init() {
// Initialize listener.
// ...
FacebookSdk.sdkInitialize(activity);
// FacebookSdk.setApplicationId(activity.getString(R.string.facebook_app_id));
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
for (UserInfo usr : user.getProviderData()) {
if (usr.getProviderId().equals("facebook.com")) {
Utils.d("FB:AuthStateChanged:signed_in:"+
user.getUid());
successLogin(user);
}
}
} else {
// User is signed out
Utils.d("FB:onAuthStateChanged:signed_out");
successLogOut();
}
// update user details;
}
};
// AppEventsLogger.activityApp(activity);
initCallbacks();
onStart();
Utils.d("Facebook auth initialized.");
}
示例12: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
generator();
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
AppEventsLogger.activateApp(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
LogSaver.appendLog(TAG);
logoiv = (ImageView) findViewById(R.id.imageView);
TextView tv2016= (TextView) findViewById(R.id.l2016);
Typeface typeface1=Typeface.createFromAsset(getAssets(),"canaro_extra_bold.otf");
tv2016.setTypeface(typeface1);
Typeface typeface=Typeface.createFromAsset(getAssets(),"canaro_extra_bold.otf");
ShimmerTextView textView = (ShimmerTextView) findViewById(R.id.shimmertv);
KenBurnsView kenBurnsView= (KenBurnsView) findViewById(R.id.kbview);
kenBurnsView.animate().setDuration(500).start();
if (textView != null) {
textView.setTypeface(typeface);
}
Shimmer shimmer = new Shimmer();
shimmer.start(textView);
nextActivity();
}
示例13: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feeds);
LogSaver.appendLog(TAG);
cacher();
progressBar=(ProgressBar) findViewById(R.id.feed_progress);
toolbar= (Toolbar) findViewById(R.id.feed_toolbar);
toolbar.setNavigationIcon(R.drawable.backbutton);
FacebookSdk.sdkInitialize(getApplicationContext());
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
lvfeed= (ListView) findViewById(R.id.feed_list);
ConnectionDetector ob=new ConnectionDetector(getApplicationContext());
// if (!ob.isConnecting())
// {
// Toast.makeText(getApplicationContext(),"Please connect to Internet",Toast.LENGTH_LONG).show();
// }
// else{
new Background().execute(FEED_URl);
//}
}
示例14: onCreate
import com.facebook.FacebookSdk; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
AppInjector.init(this);
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
}
示例15: 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();
}