android-fusedlocation

Guarantee that android keeps on retrieving sensor data

心不动则不痛 提交于 2019-12-14 02:51:50
问题 I'm developing an app that tracks trips. After searching about this matter, I concluded that the best way to achieve this (continuously track the user's location) is to use a foreground service. In some cases is working quite well, but in some other cases (even with DOZE off), I get some time intervals in which the phone is completely still and I stop getting sensor data (either accelerometer or locations from fused location provider). This problem got worse when I tried it in an Android 9

Oreo: how to catch location update from the background?

五迷三道 提交于 2019-12-13 06:30:54
问题 I migrate my app to oreo (as it's requiered by google play now), and i have now an error when i start my phone : Not allowed to start service Intent My app is listening in background any location update and send periodically those grabbed locations to a server. for this i do : in AndroidManifest.xml <receiver android:name="com.myapp.StartServiceBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> in the

How to receive location updates every 5 minutes using the FusedLocation API

限于喜欢 提交于 2019-12-12 07:38:54
问题 I am currently working on an app that has to check the user's location every five minutes and send the coordinates to a server. I decided to go with the FusedLocation API in Google Play Services instead of the plain old LocationManager API, mainly because I noticed the LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY priority level, which claims to offer a 100-meter accuracy level with reasonable battery usage, which is EXACTLY what I need. In my case, I have an Activity whose inheritance

google play services location api sometimes give wrong location

柔情痞子 提交于 2019-12-12 03:25:35
问题 My app use Google Play service API to get the user location and check if the device is inside or outside a particular area of 50 mt of radius. The app use PRIORITY_HIGH_ACCURACY and a Interval of 1 minute. So I create GoogleApiClient: mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mGoogleApiClient.connect(); In the onConnected callback: mLocationRequest = new LocationRequest();

App Crashes While Requesting Location Updates With The Help Of Fused Location

一世执手 提交于 2019-12-11 14:51:51
问题 I was requesting the location updates with the help of LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, locationListener); But As I tried to mention this on a swtich onClickListener , it crashed. However there was no error thrown Android Studio itself. I already have added permission to request Fused Location, coarse Location and Internet as part of this function. I even tried to connect the google Api client before requesting the Updated Like., if

Having Issue in FusedApi

孤人 提交于 2019-12-11 09:09:06
问题 My app is working fine but sometimes its start toasting "Location not detected" and after some hours,app itself start showing the user location latitude and longitude.I knew already there are many answers for getting "user location".But in my scenario I'am achieving what I want but for some hours sometimes even for half day it didn't get the location and get corrected itself. public class CampaignFormData extends BaseActivity implements ConnectionCallbacks, OnConnectionFailedListener,

The Geo-Cordinates getting is Very Far from previous one

旧时模样 提交于 2019-12-11 06:41:05
问题 In my application there is provision to track how much distance a person is travelled.There is a Service class for getting the current lat and long perodically.Some times the points getting is fine.Othertimes it is not.I started from a point and walked around 500m and came back to the samepoint ,but the distance calculated was 3.5 k.m. For finding the distance travelled ,I take the difference in between Current and previous location.The values are added with new value and goes on until last

Location updates not working on allowing runtime permission

梦想的初衷 提交于 2019-12-11 05:07:38
问题 I've written code for app that shows phone's latitude and longitude and displays it on the screen, but after granting location permission it doesn't show anything, only when I reopen the app. This is the code for the MainActivity: import android.Manifest; import android.content.pm.PackageManager; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import

How to get FusedLocation from IntentService

孤者浪人 提交于 2019-12-08 17:24:50
问题 How to retrieve current location by using the new FusedLocation API from an IntentService ? How can i make sure that IntentService will receive all callbacks from FusedLocation API ? ie, How can i obtain the location object synchronously? 回答1: This may help you import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import

Unable to view current coordinates on button click in android studio

回眸只為那壹抹淺笑 提交于 2019-12-08 04:16:13
问题 I am creating an app which will get a user name from DB and print the ID and then on button click it will show the current GPS coordinates . I have implemented it but don't know why its not working. Here is my Manifest file <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS