android-geofence

Geofence transition PendingIntent blocked by the OS on Android Oreo

久未见 提交于 2019-12-02 21:30:30
This only happens on Android Oreo. I'm using Play Services 11.4.2. I'm registering geofences using the GeofencingClient and the addGeofences method with a pendingIntent to an IntentService that is handling geofence transitions. It looks like the intent sent by the play services is blocked by the OS in certain conditions. The system logs the following: Background start not allowed: service Intent { cmp=my.app.id/my.package.struct.GeofenceTransIntentService (has extras) } to my.app.id/my.package.struct.GeofenceTransIntentService from pid=-1 uid=10154 pkg=my.app.id as soon as I add a geofence in

Do I need to acquire wake lock when invoking a BroadcastReceiver

不羁岁月 提交于 2019-12-02 15:21:45
问题 In the book Pro Android 4 By Satya Komatineni , Dave MacLean I've found: Android acquires a partial wake lock when invoking a broadcast service and releases it when it returns from the service in the main thread Does it mean that the Android OS ensures that the device will wake up for the time of going through onReceive of BroadcastReceiver ? In my case the BroadcastReceiver should get an intent from Google Play Services (GoogleLocationServices and to be precise Geofences api). Where is it

Do I need to acquire wake lock when invoking a BroadcastReceiver

こ雲淡風輕ζ 提交于 2019-12-02 12:52:04
In the book Pro Android 4 By Satya Komatineni , Dave MacLean I've found: Android acquires a partial wake lock when invoking a broadcast service and releases it when it returns from the service in the main thread Does it mean that the Android OS ensures that the device will wake up for the time of going through onReceive of BroadcastReceiver ? In my case the BroadcastReceiver should get an intent from Google Play Services (GoogleLocationServices and to be precise Geofences api ). Where is it documented? EDIT: I've also found it here : because it is guaranteed that the BroadcastReceiver

Permission exception even though permission is set in manifest [duplicate]

纵然是瞬间 提交于 2019-12-01 14:31:46
This question already has an answer here: Android permission doesn't work even if I have declared it 12 answers In my manifest I have: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> However, when I run my app and press the button that needs this permission I get the following exception: Geofence usage requires ACCESS_FINE_LOCATION permission How can I fix this? I have the permission right under <manifest> I am using Android 6. This is my code: public void addGeofencesButtonHandler(View view) { if (!mGoogleApiClient.isConnected()) { Toast.makeText(this, getString(R

How to get number of pixels equals to a radius of Geozone circle according to zoom level? OR Radius of zone circle to screen pixels?

亡梦爱人 提交于 2019-12-01 12:23:28
I am creating Geozones on google map. Default Circle that map API provides is laggy when scroll the map. So, I wanted to create my own circle (overlay on map). I created circle with radius of 300 meters which is fixed. The width of this circle should change according to the zoom level as the default map circle does. I have writen a method as below that calculates pixels by taking Radius and Zoom level as parameters. I have added the default circle also to verify the accuracy of my circle for different addresses. //Adjusts the width and height of circle according to radius and zoom level

Android: How to make user create geofence for another tracked users?

时光毁灭记忆、已成空白 提交于 2019-12-01 01:16:12
How to implement Geofence for tracking another users? I am developing an application which will track family members, and I want to implement Geofence feature which will enable user to do for ex: user A will track user B user A will determine the geofence area and when user B will enter this geofence user A will get a notification I retreived the location of user B every 10 minutes and I want to create Geofence for user B which will notify user A when user B enter the geofence area I try to use google Geofence like this code : mGeofenceList.add(new Geofence.Builder() // Set the request ID of

Change Location Mode to High Accuracy Programmatically Android

♀尐吖头ヾ 提交于 2019-11-30 12:30:50
问题 Is it possible to get the information on the location mode which the user has selected among the three modes under the location settings options i.e 1.Hight Accuracy 2.Battery Saving 3.GPS Only I want to programmatically check if user has selected High Accuracy mode if not then enable it automatically. Is it possible ? Please advice. 回答1: It is possible to get the device's current location mode since API level 19 (Kitkat) : public int getLocationMode(Context context) { return Settings.Secure

Change Location Mode to High Accuracy Programmatically Android

此生再无相见时 提交于 2019-11-30 04:26:35
Is it possible to get the information on the location mode which the user has selected among the three modes under the location settings options i.e 1.Hight Accuracy 2.Battery Saving 3.GPS Only I want to programmatically check if user has selected High Accuracy mode if not then enable it automatically. Is it possible ? Please advice. kaolick It is possible to get the device's current location mode since API level 19 (Kitkat) : public int getLocationMode(Context context) { return Settings.Secure.getInt(activityUnderTest.getContentResolver(), Settings.Secure.LOCATION_MODE); } These are the

Android LocationServices.GeofencingApi example usage

北城余情 提交于 2019-11-29 23:14:58
Does anyone know of an example of using the LocationServices.GeofencingApi? All the android geofencing examples I find are using the deprecated LocationClient class. From what I can see, the LocationServices class is the one to use, but there doesn't seem to be any working examples on how to use it. The closest I've found is this post highlighting location update requests UPDATE: The closest answer I've found is this git example project - but it still uses the deprecated LocationClient to get triggered fences. L93 I just migrated my code to the new API. Here is a working example: A working

Find the closest point on polygon to user location

让人想犯罪 __ 提交于 2019-11-29 08:15:20
I have an app that find the shortest distance between my user to a polygon. I want to convert the polygon to Geofence to check the distance between the user to the area to give mor accurate information to the user. how can I do that? this is the MapsActivity public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, LocationListener, MinimumDistanceTask.GetMinimumDistanceListener { private GoogleMap mMap; private LocationManager manager; private double lat, lng; private KmlLayer layer; private LatLng latLngTest; private boolean contains = false; private ArrayList<LatLng>