當前位置: 首頁>>代碼示例>>Java>>正文


Java LinkedInOAuthServiceFactory類代碼示例

本文整理匯總了Java中com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory的典型用法代碼示例。如果您正苦於以下問題:Java LinkedInOAuthServiceFactory類的具體用法?Java LinkedInOAuthServiceFactory怎麽用?Java LinkedInOAuthServiceFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LinkedInOAuthServiceFactory類屬於com.google.code.linkedinapi.client.oauth包,在下文中一共展示了LinkedInOAuthServiceFactory類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setWebView

import com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory; //導入依賴的package包/類
/**
 * setting up the webview
 */
@SuppressLint("SetJavaScriptEnabled")
private void setWebView() {
	LinkedinDialog.oAuthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(
			Config.LINKEDIN_CONSUMER_KEY, Config.LINKEDIN_CONSUMER_SECRET);
	LinkedinDialog.factory = LinkedInApiClientFactory.newInstance(Config.LINKEDIN_CONSUMER_KEY,
			Config.LINKEDIN_CONSUMER_SECRET);

	LinkedinDialog.liToken = LinkedinDialog.oAuthService.getOAuthRequestToken(Config.OAUTH_CALLBACK_URL);

	WebView mWebView = (WebView) findViewById(R.id.webkitWebView1);
	mWebView.getSettings().setJavaScriptEnabled(true);

	Log.i("LinkedinSample", LinkedinDialog.liToken.getAuthorizationUrl());
	mWebView.loadUrl(LinkedinDialog.liToken.getAuthorizationUrl());
	mWebView.setWebViewClient(new LinkedInWebViewClient());
	ImageButton crossButton = (ImageButton) findViewById(R.id.crossBtn);
	crossButton.setOnClickListener(new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			cancel();
		}
	});
}
 
開發者ID:mastersoftwaresolutions,項目名稱:android_socialmedia,代碼行數:28,代碼來源:LinkedinDialog.java

示例2: setWebView

import com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory; //導入依賴的package包/類
/**
 * set webview.
 */
private void setWebView() {
	LinkedinDialog.oAuthService = LinkedInOAuthServiceFactory.getInstance()
			.createLinkedInOAuthService(Config.LINKEDIN_CONSUMER_KEY,
					Config.LINKEDIN_CONSUMER_SECRET);
	LinkedinDialog.factory = LinkedInApiClientFactory.newInstance(
			Config.LINKEDIN_CONSUMER_KEY, Config.LINKEDIN_CONSUMER_SECRET);

	LinkedinDialog.liToken = LinkedinDialog.oAuthService
			.getOAuthRequestToken(Config.OAUTH_CALLBACK_URL);

	WebView mWebView = (WebView) findViewById(R.id.webkitWebView1);
	mWebView.getSettings().setJavaScriptEnabled(true);

	Log.i("LinkedinSample", LinkedinDialog.liToken.getAuthorizationUrl());
	mWebView.loadUrl(LinkedinDialog.liToken.getAuthorizationUrl());
	mWebView.setWebViewClient(new HelloWebViewClient());

	mWebView.setPictureListener(new PictureListener() {
		@Override
		public void onNewPicture(WebView view, Picture picture) {
			if (progressDialog != null && progressDialog.isShowing()) {
				progressDialog.dismiss();
			}

		}
	});

}
 
開發者ID:ohmp,項目名稱:UniversalSocialLoginAndroid,代碼行數:32,代碼來源:LinkedinDialog.java

示例3: callApiMethod

import com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory; //導入依賴的package包/類
protected InputStream callApiMethod(String apiUrl, int expected, List<HttpHeader> httpHeaders) {
    try {
        LinkedInOAuthService oAuthService = LinkedInOAuthServiceFactory.getInstance()
                .createLinkedInOAuthService(this.getApiConsumer().getConsumerKey(),
                        this.getApiConsumer().getConsumerSecret());
        URL url = new URL(apiUrl);
        HttpURLConnection request = (HttpURLConnection) url.openConnection();

        if (connectTimeout > -1) {
            request.setConnectTimeout(connectTimeout);
        }

        if (readTimeout > -1) {
            request.setReadTimeout(readTimeout);
        }

        for (String headerName : this.getRequestHeaders().keySet()) {
            request.setRequestProperty(headerName, (String) this.getRequestHeaders().get(headerName));
        }

        for (HttpHeader header : httpHeaders) {
            request.setRequestProperty(header.getName(), header.getValue());
        }
        oAuthService.signRequestWithToken(request, this.getAccessToken());
        request.connect();

        if (request.getResponseCode() != expected) {
            Error error = (Error) readResponse(
                    Error.class,
                    getWrappedInputStream(request.getErrorStream(),
                            "gzip".equalsIgnoreCase(request.getContentEncoding())));

            throw createLinkedInApiClientException(error);
        }
        return getWrappedInputStream(request.getInputStream(),
                "gzip".equalsIgnoreCase(request.getContentEncoding()));
    } catch (IOException e) {
        throw new LinkedInApiClientException(e);
    }
}
 
開發者ID:Glamdring,項目名稱:welshare,代碼行數:41,代碼來源:ExtendedLinkedInApiClient.java


注:本文中的com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。