android-location

Geofences not working when app is killed

跟風遠走 提交于 2019-12-20 10:40:30
问题 I know similar questions have been asked before but answers were not perfect. I created an app with geofences using the sample code from android developer website. I did not use any shared preferences to store geofences as I am not removing the geofences. I am testing the app from within the geofence, but my smartphone receives notifications every time the app runs and no notifications are observed when the app is killed. Why does this happen? I think I am supposed to receive notifications

Get the coordinates of the center of a view

谁都会走 提交于 2019-12-20 04:53:39
问题 I am trying to get the center coordinates of my custom view (a circle) so that I can draw a line from the those points. The custom view is inside a TableLayout which is itself inside a FrameLayout . However, I am having trouble - this code doesn't get it right. Any advice please? The values given by this method are wrong on all devices. If I change the layout padding/margins etc. then the dots obviously move, but the point given by this method does not change. public float[]

Get the coordinates of the center of a view

元气小坏坏 提交于 2019-12-20 04:53:00
问题 I am trying to get the center coordinates of my custom view (a circle) so that I can draw a line from the those points. The custom view is inside a TableLayout which is itself inside a FrameLayout . However, I am having trouble - this code doesn't get it right. Any advice please? The values given by this method are wrong on all devices. If I change the layout padding/margins etc. then the dots obviously move, but the point given by this method does not change. public float[]

Does the geocoder work on emulators

百般思念 提交于 2019-12-20 02:36:13
问题 I am using the geocoder and it worked just fine on my device but not working on emulators tried it on 2.2 and 4.2.2 didn't work; this is my code: Geocoder myLocation = new Geocoder(AzanTime.this, Locale.getDefault()); List<Address> myList=null; try { myList = myLocation.getFromLocation(latitude,longitude, 1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Address address = (Address) myList.get(0); String addressStr = ""; if(address.getAddressLine(0)!=null)

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

痴心易碎 提交于 2019-12-19 04:52:25
问题 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

Google Location Services Vs Android Location Services

浪子不回头ぞ 提交于 2019-12-19 02:32:17
问题 As we know we have two alternates for making our applicaiton location aware Either we use Google’s Location Services API (part of Google Play services) or we use Androids Location API . The problem I have here is that using the Google's services , we have to use interface com.google.android.gms.location.LocationListener that provides us with location updates. However unlike the android.location.LocationListener, the google's version doesnt' provides us the state of the location provider (gps

Android LocationRequest: get a callback when request expires

纵饮孤独 提交于 2019-12-18 19:02:07
问题 im wonder how to catch event or what ever when my LocationReqest expired, heres code then i call it mLocationRequest = LocationRequest.create(); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); mLocationRequest.setExpirationDuration(500); mLocationRequest.setNumUpdates(1); mLocationClient.requestLocationUpdates(mLocationRequest, this); now i need to get know that my LocationRequest was break, ty for help :) edit i thought i could catch it in public void onLocationChanged

How to ask user to enable GPS at the launch of application?

徘徊边缘 提交于 2019-12-18 16:51:33
问题 private void turnGPSOn(){ String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if(!provider.contains("gps")){ //if gps is disabled final Intent poke = new Intent(); poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse("3")); sendBroadcast(poke); } } see the Logcat 04/20 17:35:26: Launching app $ adb push F:

PRIORITY_LOW_POWER vs PRIORITY_BALANCED_POWER_ACCURACY for google play service v2

自作多情 提交于 2019-12-18 12:27:40
问题 I'm wondering for the fused location, does any of the above use a combination of gps + wifi network together? what is the difference in terms of provider (does any of it uses the gps)? from what i see in the documentation the difference is only distance I've previously worked with LocationManager and used NETWORK_PROVIDER and GPS_PROVIDER together to get a combination of those two provider. 回答1: The new fused location providers take a slightly different approach compared to previous methods.

Android: Drag map while keeping marker at the center

笑着哭i 提交于 2019-12-18 04:09:17
问题 I am currently getting Current Location of device (lat,lng) in MapActivity. Now , I want to let the user move the map, while keeping the marker at the center. This means that whenever the map is moved, current location will be updated. (Right?) I followed this How to move a map under a marker? and How to attach a flexible marker on map something like Uber and Lyft? but couldn't get my concept clear. Activity_map.xml (Here I have added ImageView) <RelativeLayout android:layout_width="match