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(); }
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(); }
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(); }