android-gps

Run Gps as background service and Compare the received current Location Data with value in Sqlite?

风格不统一 提交于 2019-12-11 04:49:50
问题 I know there are many questions that have been asked regarding this and i have been going through all that from couple of days but couldn't find a reasonable answer.I am newbie to android so i have no idea how things get done. Basically I want to know how to run GPS as a service in background like when the application is installed it starts and how to compare that data received from gps background service with data in SQLite Data Base. 回答1: you can make service like above , this service get

Track Gps At every 10 minutes using timer in android

久未见 提交于 2019-12-11 04:12:55
问题 I am developing an android application and I am using a service that tracks location via GPS every 10 minutes. But when I put the location listener in a timer task, it throws an exception: Cannot put code inside thread that has not called looper.prepare() . Does anyone have any insight on this problem? 回答1: You need not to start a service for recieving locationUpdate every 10 min instead do something like this mLocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

RoboScript not able click Enable Location OK button in Firebase Testlab

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 19:56:04
问题 I am trying to test an Google Map based Android app using RoboScript on Firebase TestLab. By default location is disabled on TestLab devices. To enable them we need to simulate a click on OK button on the system prompt. But this click never happens. You can see the screenshot below. The OK button never gets pressed and flow stops here. I checked the RoboScript json file. Android studio never recorded the OK button click. I tried to create another element like below. But couldn't identify what

Android, get the location when the screen is off

只愿长相守 提交于 2019-12-10 19:03:29
问题 I use a started service with the fused api, and implement the location listener directly on it. The Location keeps updating even when the screen is locked, But it stops if the screen goes off. So, is there any way to make sure that the location will keep updating when the screen is off? I read a lot of other questions and I don't really know what i'm missing. public class CLocationService extends Service implements GoogleApiClient.ConnectionCallbacks, LocationListener, GoogleApiClient

Not getting latitude and longitude from background service

 ̄綄美尐妖づ 提交于 2019-12-10 11:56:20
问题 I am new in android I want to run a service in background and get latitude and longitude or Geo address after 10 minutes and send to the server. Please help me. Here is my code: In Activity public void serviceCall(){ Log.e("INSIDE ALARM", "INSIDE ALARM"); Intent intent = new Intent(getApplicationContext(), MyService.class); final PendingIntent pIntent = PendingIntent.getBroadcast(this, MyService.REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT); long firstMillis = System

how to change the location mode to “high accuracy/battery saving” form it default mode(device only)

隐身守侯 提交于 2019-12-09 06:29:10
问题 I'm trying to implement a google map for getting current location using this tutorial android google map tutorial The problem is ,It is not getting my current location untill I have started my device's google map and grant permission to access google location services. After this my application also get my current location. And it's working fine untill location is on in the device. And when location is turned off it's again need to started device's google map and grant permission for google

onLocationChanged(Location location) is not working - Android [duplicate]

故事扮演 提交于 2019-12-08 15:05:25
问题 This question already has answers here : onLocationChanged() is never trigered by requestLocationUpdate() - Android (2 answers) Closed 2 years ago . I have used manager.requestLocationUpdates("gps", 1800000, 1, new LocationDetector()); method of LocationManager manager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); class for getting update when either location change (device's location) is at least 1 meter (almost 40 inches), OR at least 30 minutes has passed. But the update

get latitude location after fixed interval

孤街浪徒 提交于 2019-12-08 11:24:17
问题 For a speed measuring app, I need to get the latitude and longitude updates after every four seconds. I've used the sleep function between the two calls to getLatitude and getLongitude functions. But printing it on screen shows the value remains the same i.e. lon1 and lon2, as doubles (14 places after the decimal) have exactly the same value and hence speed too is shown 0. How to get Latitude and Longitude after fixed intervals of time (4 secs here)? Much thanks in advance. locationManager =

requestLocationUpdates() method is giving updates without change in location - Android

瘦欲@ 提交于 2019-12-08 10:10:41
问题 I have used onLocationChanged method of LocationListener for detecting change in location of my device. In requestLocationUpdates method I have set minimum Time = 5 seconds and minimum Distance = 2 meters, but requestLocationUpdates method is giving me updates even when my device is not moved at all (placed stationary). So please tell what is the issue with my code? This my code: public class LocationDetector implements LocationListener { @Override public void onLocationChanged(Location

Google map inside another fragment - Function like onLocationChanged is not working

岁酱吖の 提交于 2019-12-08 09:48:15
问题 My previous question Google map inside another fragment - Error when calling getMapAsync was answered. The google map is showing and the getMapAsync is now working. And I'm now finding the solution to the other functions like public void onLocationChanged(Location location) {...} public void onConnected(Bundle bundle) {...} Note: I'm trying to convert a google map activity to work inside a fragment that will be called in NavigationView. samplemapFragment.java package com.sample.samplemap;