2013-01-19 3 views
0

사용자 이름과 비밀번호를 입력하고 "로그인하여 허용"버튼을 클릭 한 후 안드로이드에서 데이터를 공유하기 위해 linkedin 통합을 수행하고 있습니다. 대신 다음 페이지로 이동할 수 없습니다. 이전 페이지로 돌아와서 벽에 게시되지 않은 데이터는 많은 자습서, 링크를 시도했지만 내 실수를 찾아 낼 수 없었고 많은 어려움을 겪었습니다. 아무도 도와 주실 수 없습니다. 여기 내 MainActivity 코드의linkedin : 메시지가 게시되지 않았습니다.

public class MainActivity extends Activity { 
public static final String CONSUMER_KEY    = "key"; 
public static final String CONSUMER_SECRET   = "secret";  
public static final String APP_NAME     = "rebuix"; 
public static final String OAUTH_CALLBACK_SCHEME = "x-oauthflow-linkedin"; 
public static final String OAUTH_CALLBACK_HOST  = "litestcalback"; 
public static final String OAUTH_CALLBACK_URL  = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST; 


LinkedInOAuthService oAuthService = LinkedInOAuthServiceFactory 
     .getInstance().createLinkedInOAuthService(CONSUMER_KEY, 
       CONSUMER_SECRET); 
LinkedInApiClientFactory factory = LinkedInApiClientFactory 
     .newInstance(CONSUMER_KEY, CONSUMER_SECRET); 
LinkedInRequestToken liToken; 
LinkedInApiClient client; 


@SuppressLint({ "NewApi", "NewApi", "NewApi" }) 
Button btnLinkedin; 


@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 

    if (android.os.Build.VERSION.SDK_INT > 9) { 
     StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() 
       .permitAll().build(); 
     StrictMode.setThreadPolicy(policy); 
    } 

    Button btnLinkedinMain = (Button) findViewById(R.id.btnLinkedin); 
    btnLinkedinMain.setOnClickListener(new View.OnClickListener() { 



public void onClick(View v) { 

    if (v.getId() == R.id.btnLinkedin) { 

     oAuthService = LinkedInOAuthServiceFactory.getInstance() 
       .createLinkedInOAuthService(Constants.CONSUMER_KEY, 
         Constants.CONSUMER_SECRET); 
     System.out.println("oAuthService : " + oAuthService); 

     factory = LinkedInApiClientFactory.newInstance(
       Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET); 

     liToken = oAuthService 
       .getOAuthRequestToken(Constants.OAUTH_CALLBACK_URL); 

     Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(liToken 
       .getAuthorizationUrl())); 

     i.putExtra("sms_body", false); 
     try 
     { 
         startActivity(i); 
    } catch (ActivityNotFoundException e) { 
     // Display some sort of error message here. 
    } 
    } 
} 

protected void onNewIntent(Intent intent) { 


    try { 
     linkedInImport(intent); 
    } catch (NullPointerException e) { 
     e.printStackTrace(); 
    } 
} 

private void linkedInImport(Intent intent) { 
    String verifier = intent.getData().getQueryParameter("oauth_verifier"); 
    System.out.println("liToken " + liToken); 
    System.out.println("verifier " + verifier); 

    LinkedInAccessToken accessToken = oAuthService.getOAuthAccessToken(
      liToken, verifier); 
    client = factory.createLinkedInApiClient(accessToken); 

    // client.postNetworkUpdate("LinkedIn Android app test"); 

    Person profile = client.getProfileForCurrentUser(EnumSet.of(
      ProfileField.ID, ProfileField.FIRST_NAME, 
      ProfileField.LAST_NAME, ProfileField.HEADLINE)); 

    System.out.println("First Name :: " + profile.getFirstName()); 
    System.out.println("Last Name :: " + profile.getLastName()); 
    System.out.println("Head Line :: " + profile.getHeadline()); 

}; 

    }); 
} 
    } 
+0

안녕하세요, http://code.google.com/p/socialauth-android/source/checkout에서 최신 코드를 다운로드하십시오. 여전히 문제가 발견되면 문제 제기 양식에 귀하의 메시지를 게시하십시오, 우리는 당신을 도울 것입니다. – vineet

+0

나는 그 코드도 다운로드했지만 여전히 강제로 닫기 @ vineet –

+0

안녕하세요, socialauth 문제 로그에 문제를 엽니 다. 우리는 그것을 해결하려고 노력할 것입니다. – vineet

답변

0

이 튜토리얼을 시도 ... 당신은 ...이 링크를 참조하여 응용 프로그램의 단계 통합에 의해 단계에 대해이 tutorial..and에 메시지 게시 기능을 얻을 것이다 http://code.google.com/p/socialauth-android/wiki/Linkedin

https://github.com/srivastavavivek1987/LinkedIn-Connection-in-Android

+0

나는이 링크를 http://code.google.com/p/socialauth-android/wiki/Linkedin에도 시도했지만 다운로드 후 프로젝트를 실행하면 닫기 @ Mehul Ranpara –

+0

이 링크에서 코드를 다운로드하십시오 ... https : //github.com/srivastavavivek1987/LinkedIn-Connection-in-Android –

관련 문제