Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- App42API.initialize(getApplicationContext(), "MY_API_KEY","MY_SECRET_KEY");
- FacebookSdk.sdkInitialize(getApplicationContext());
- callbackManager = CallbackManager.Factory.create();
- setContentView(R.layout.activity_main);
- LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "user_friends"));
- loginButton = (LoginButton)findViewById(R.id.login_button);
- loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
- @Override
- public void onSuccess(LoginResult loginResult) {
- Profile profile = Profile.getCurrentProfile();
- AccessToken token = AccessToken.getCurrentAccessToken();
- String userName = profile.getId();
- String accessToken = token.toString();
- socialService.linkUserFacebookAccount(userName, accessToken, new App42CallBack() {
- public void onSuccess(Object response) {
- Social social = (Social) response;
- System.out.println("userName is " + social.getUserName());
- System.out.println("fb Access Token is " + social.getFacebookAccessToken());
- String jsonResponse = social.toString();
- }
- public void onException(Exception ex) {
- System.out.println("Exception Message" + ex.getMessage());
- }
- });
- }
- @Override
- public void onCancel() {
- }
- @Override
- public void onError(FacebookException e) {
- }
- });
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- callbackManager.onActivityResult(requestCode, resultCode, data);
- }
- 07-06 16:27:16.594 9810-9862/tk.hasankassem.tapo I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
- 07-06 16:27:16.954 9810-9810/tk.hasankassem.tapo I/System.out﹕ Installation.getSession : /data/data/tk.hasankassem.tapo/files/SESSION: open failed: ENOENT (No such file or directory)
- 07-06 16:27:16.954 9810-9810/tk.hasankassem.tapo I/System.out﹕ Installation.getUser : /data/data/tk.hasankassem.tapo/files/USER: open failed: ENOENT (No such file or directory)
- 07-06 16:27:16.964 9810-9868/tk.hasankassem.tapo I/System.out﹕ Exception :com.shephertz.app42.paas.sdk.android.App42Exception: java.lang.IllegalArgumentException: key.length == 0
- 07-06 16:27:16.964 9810-9868/tk.hasankassem.tapo I/System.out﹕ Exception Messagejava.lang.IllegalArgumentException: key.length == 0
- 07-06 16:27:16.969 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables
- 07-06 16:27:16.969 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):isSBSettingEnabled false
- 07-06 16:27:16.974 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):isShipBuild true
- 07-06 16:27:16.974 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement