本文整理汇总了Java中com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleAccountCredential.initialize方法的具体用法?Java GoogleAccountCredential.initialize怎么用?Java GoogleAccountCredential.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
的用法示例。
在下文中一共展示了GoogleAccountCredential.initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMBSEndpoint
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; //导入方法依赖的package包/类
private Mobilebackend getMBSEndpoint() {
// check if credential has account name
final GoogleAccountCredential gac = mCredential == null
|| mCredential.getSelectedAccountName() == null ? null : mCredential;
// create HttpRequestInitializer
HttpRequestInitializer hri = new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) throws IOException {
request.setBackOffPolicy(new ExponentialBackOffPolicy());
if (gac != null) {
gac.initialize(request);
}
}
};
// build MBS builder
// (specify gac or hri as the third parameter)
return new Mobilebackend.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(),
hri)
.setRootUrl(Consts.ENDPOINT_ROOT_URL).build();
}
示例2: getMBSEndpoint
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; //导入方法依赖的package包/类
private Mobilebackend getMBSEndpoint() {
// check if credential has account name
final GoogleAccountCredential gac = credential == null
|| credential.getSelectedAccountName() == null ? null : credential;
// create HttpRequestInitializer
HttpRequestInitializer hri = new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) throws IOException {
request.setBackOffPolicy(new ExponentialBackOffPolicy());
if (gac != null) {
gac.initialize(request);
}
}
};
// build MBS builder
// (specify gac or hri as the third parameter)
return new Mobilebackend.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), hri)
.setRootUrl(Consts.ENDPOINT_ROOT_URL).build();
}
示例3: getMBSEndpoint
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; //导入方法依赖的package包/类
private Mobilebackend getMBSEndpoint() {
// check if credential has account name
final GoogleAccountCredential gac = credential == null || credential.getSelectedAccountName() == null ? null
: credential;
// create HttpRequestInitializer
HttpRequestInitializer hri = new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) throws IOException {
request.setBackOffPolicy(new ExponentialBackOffPolicy());
if (gac != null) {
gac.initialize(request);
}
}
};
// build MBS builder
// (specify gac or hri as the third parameter)
return new Mobilebackend.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), hri).setRootUrl(
Consts.ENDPOINT_ROOT_URL).build();
}