本文整理匯總了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();
}
});
}
示例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();
}
}
});
}
示例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);
}
}