Add missing google play services permission

pull/281/head
Alex Baker 11 years ago
parent b975dae84c
commit 1d6a5c8f64

@ -27,8 +27,8 @@ android {
buildToolsVersion "22.0.1"
defaultConfig {
versionCode 357
versionName "4.7.9"
versionCode 358
versionName "4.7.10"
minSdkVersion 7
targetSdkVersion 22
}

@ -12,6 +12,7 @@
<!-- location based reminders -->
<!-- ************************ -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-sdk tools:overrideLibrary="com.google.android.gms,com.google.android.gms.location,com.google.android.gms.maps" />

@ -46,7 +46,6 @@ public class LocationPickerDialog extends InjectingDialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
managedGoogleApi.requestGeoData();
managedGoogleApi.connect();
View layout = inflater.inflate(R.layout.location_picker_dialog, null);

@ -89,9 +89,7 @@ public class GeofenceApi {
}
private void newClient(final GoogleApi.GoogleApiClientConnectionHandler handler) {
new GoogleApi(context)
.requestLocationServices()
.connect(handler);
new GoogleApi(context).connect(handler);
}
private List<com.google.android.gms.location.Geofence> getRequests(List<Geofence> geofences) {

@ -3,6 +3,8 @@ package org.tasks.location;
import android.content.Intent;
import com.google.android.gms.location.GeofencingEvent;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.data.Metadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -17,8 +19,8 @@ public class GeofenceTransitionsIntentService extends InjectingIntentService {
private static final Logger log = LoggerFactory.getLogger(GeofenceTransitionsIntentService.class);
@Inject GeofenceService geofenceService;
@Inject Broadcaster broadcaster;
@Inject MetadataDao metadataDao;
public GeofenceTransitionsIntentService() {
super(GeofenceTransitionsIntentService.class.getSimpleName());
@ -47,11 +49,13 @@ public class GeofenceTransitionsIntentService extends InjectingIntentService {
}
private void triggerNotification(com.google.android.gms.location.Geofence triggeringGeofence) {
String requestId = triggeringGeofence.getRequestId();
try {
Geofence geofence = geofenceService.getGeofenceById(Long.parseLong(triggeringGeofence.getRequestId()));
Metadata fetch = metadataDao.fetch(Long.parseLong(requestId), Metadata.TASK, GeofenceFields.PLACE, GeofenceFields.LATITUDE, GeofenceFields.LONGITUDE, GeofenceFields.RADIUS);
Geofence geofence = new Geofence(fetch);
broadcaster.requestNotification(geofence.getMetadataId(), geofence.getTaskId());
} catch(Exception e) {
log.error(e.getMessage(), e);
log.error(String.format("Error triggering geofence %s: %s", requestId, e.getMessage()), e);
}
}
}

@ -31,19 +31,11 @@ public class GoogleApi implements GoogleApiClient.OnConnectionFailedListener, Go
@Inject
public GoogleApi(@ForApplication Context context) {
builder = new GoogleApiClient.Builder(context, this, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this);
}
public GoogleApi requestLocationServices() {
builder.addApi(LocationServices.API);
return this;
}
public GoogleApi requestGeoData() {
builder.addApi(Places.GEO_DATA_API);
return this;
}
public void connect(final GoogleApiClientConnectionHandler googleApiClientConnectionHandler) {
this.googleApiClientConnectionHandler = googleApiClientConnectionHandler;
googleApiClient = builder.build();

@ -66,13 +66,12 @@ public class ManagedGoogleApi extends GoogleApi implements GoogleApi.GoogleApiCl
}
public void getPlaceDetails(final String placeId, final ResultCallback<PlaceBuffer> callback) {
Places.GeoDataApi.getPlaceById(googleApiClient, placeId)
.setResultCallback(new ResultCallback<PlaceBuffer>() {
Places.GeoDataApi.getPlaceById(googleApiClient, placeId).setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(PlaceBuffer places) {
callback.onResult(places);
}
}, 15, TimeUnit.SECONDS);
});
}
public void getAutocompletePredictions(final String constraint, final ResultCallback<AutocompletePredictionBuffer> callback) {
@ -91,6 +90,7 @@ public class ManagedGoogleApi extends GoogleApi implements GoogleApi.GoogleApiCl
Location lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
return new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
} catch (Exception e) {
log.error(e.getMessage(), e);
return new LatLng(0, 0);
}
}

@ -367,10 +367,6 @@ public class AndroidUtilities {
return !atLeastJellybean();
}
public static boolean preLollipop() {
return !atLeastLollipop();
}
public static boolean atLeastFroyo() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
}

@ -39,10 +39,6 @@ public class GeofenceService {
this.geofenceApi = geofenceApi;
}
public Geofence getGeofenceById(long metadataId) {
return new Geofence(metadataDao.fetch(metadataId, Metadata.TASK, GeofenceFields.PLACE, GeofenceFields.LATITUDE, GeofenceFields.LONGITUDE, GeofenceFields.RADIUS));
}
public List<Geofence> getGeofences(long taskId) {
return toGeofences(metadataDao.toList(Query.select(
Metadata.PROPERTIES).where(MetadataCriteria.byTaskAndwithKey(

Loading…
Cancel
Save