Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. @Override
  2. protected void onCreate(Bundle savedInstanceState) {
  3. super.onCreate(savedInstanceState);
  4. App42API.initialize(getApplicationContext(), "MY_API_KEY","MY_SECRET_KEY");
  5. FacebookSdk.sdkInitialize(getApplicationContext());
  6. callbackManager = CallbackManager.Factory.create();
  7. setContentView(R.layout.activity_main);
  8. LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "user_friends"));
  9. loginButton = (LoginButton)findViewById(R.id.login_button);
  10. loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
  11. @Override
  12. public void onSuccess(LoginResult loginResult) {
  13. Profile profile = Profile.getCurrentProfile();
  14. AccessToken token = AccessToken.getCurrentAccessToken();
  15.  
  16. String userName = profile.getId();
  17. String accessToken = token.toString();
  18. socialService.linkUserFacebookAccount(userName, accessToken, new App42CallBack() {
  19. public void onSuccess(Object response) {
  20. Social social = (Social) response;
  21. System.out.println("userName is " + social.getUserName());
  22. System.out.println("fb Access Token is " + social.getFacebookAccessToken());
  23. String jsonResponse = social.toString();
  24. }
  25.  
  26. public void onException(Exception ex) {
  27. System.out.println("Exception Message" + ex.getMessage());
  28. }
  29. });
  30.  
  31. }
  32.  
  33. @Override
  34. public void onCancel() {
  35.  
  36. }
  37.  
  38. @Override
  39. public void onError(FacebookException e) {
  40.  
  41. }
  42. });
  43.  
  44. }
  45.  
  46. @Override
  47. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  48. super.onActivityResult(requestCode, resultCode, data);
  49. callbackManager.onActivityResult(requestCode, resultCode, data);
  50. }
  51.  
  52. 07-06 16:27:16.594 9810-9862/tk.hasankassem.tapo I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
  53. 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)
  54. 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)
  55. 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
  56. 07-06 16:27:16.964 9810-9868/tk.hasankassem.tapo I/System.out﹕ Exception Messagejava.lang.IllegalArgumentException: key.length == 0
  57. 07-06 16:27:16.969 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables
  58. 07-06 16:27:16.969 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):isSBSettingEnabled false
  59. 07-06 16:27:16.974 9810-9867/tk.hasankassem.tapo I/System.out﹕ Thread-121146(ApacheHTTPLog):isShipBuild true
  60. 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