private String myname;
private String registered;
private SayWhen sayWhen;
+ private Latitude latitude;
public LastLocation(final Resources res, final PersistentStore store) {
super(res, store);
myname = res.getString(R.string.myname);
registered = res.getString(R.string.registered);
sayWhen = new SayWhen(res);
+ latitude = Latitude.builder(httpTransport, jsonFactory)
+ .setHttpRequestInitializer(
+ newMyAccessProtectedResource())
+ .setApplicationName("WhereAmI/1.0").build();
}
@Override
public final String getResult() {
- Latitude latitude = Latitude.builder(httpTransport, jsonFactory)
- .setHttpRequestInitializer(accessProtectedResource())
- .setApplicationName("WhereAmI/1.0").build();
try {
Log.v(TAG, "entering getResult");
Latitude.CurrentLocation.Get request =
final String TAG = getClass().getName();
- public HttpTransport httpTransport;
- public JsonFactory jsonFactory;
- public PersistentStore store;
- public String authErrorMessage;
+ static public PersistentStore store;
+ static public HttpTransport httpTransport =
+ AndroidHttp.newCompatibleTransport();
+ static public JsonFactory jsonFactory = new JacksonFactory();
+ static public String authErrorMessage;
public Oracle(final Resources res, final PersistentStore store) {
authErrorMessage = res.getString(R.string.autherror);
this.store = store;
-
- httpTransport = AndroidHttp.newCompatibleTransport();
- jsonFactory = new JacksonFactory();
}
private class MyAccessProtectedResource
extends GoogleAccessProtectedResource {
- // Why on earth contructors are not inherited?!?!
public MyAccessProtectedResource(
String accessToken,
HttpTransport transport,
}
}
- public MyAccessProtectedResource accessProtectedResource() {
+ public MyAccessProtectedResource
+ newMyAccessProtectedResource() {
AccessTokenResponse token = store.readTokens();
Log.v(TAG, "tokens - access: \"" + token.accessToken +
"\", refresh: \"" + token.refreshToken +
"\", client_id: \"" + ClientCredentials.CLIENT_ID +
"\", client_secret: \"" +
- ClientCredentials.CLIENT_SECRET +
+ ClientCredentials.CLIENT_SECRET +
"\"");
return new MyAccessProtectedResource(
token.accessToken, httpTransport, jsonFactory,
final String TAG = getClass().getName();
- private Calendar calendar;
-
private PersistentStore store;
private String calendar_name;
private String peer_name;
private String minutes2to4;
private String minutes5up;
private SayWhen sayWhen;
+ private Calendar calendar;
public PhoneLog(final Resources res, final PersistentStore store) {
super(res, store);
calendar_name = store.get("calendar_name");
peer_name = store.get("peer_name");
calendar_id = store.get("calendar_id");
+ calendar = Calendar.builder(httpTransport, jsonFactory)
+ .setHttpRequestInitializer(
+ newMyAccessProtectedResource())
+ .setApplicationName("WhereAmI/1.0").build();
}
@Override
public final String getResult() {
- calendar = Calendar.builder(httpTransport, jsonFactory)
- .setHttpRequestInitializer(accessProtectedResource())
- .setApplicationName("WhereAmI/1.0").build();
try {
Log.v(TAG, "entering getResult");
if (calendar_id == null || calendar_id == "") {