gps

Android make method run every X seconds (involves gps and server call)

强颜欢笑 提交于 2019-12-12 20:11:59
问题 I have a niche application that needs to send a server its location every few seconds. (Don't worry about a mobile phone's battery life). How would I make a thread or something execute every few seconds? I have a gpslistener but the name of its subclass is "onlocationchanged" which seems to only want to provide information if the location changed, I will need an updated location sent to the server every time though on an interval that I define How would I do this? insight appreciated 回答1:

ANDROID How to pass data (like Latitude and Longitude from GPS) to a SMS process, and send it

安稳与你 提交于 2019-12-12 19:57:16
问题 I have a class in getting latitude and longitude, and another one in receiving an SMS and sending it back to the one who requested it. It is an autoreply, For example, user A requests a location of user B via SMS without knowing that user A has this kind of request. Then automatically, it will get the current latitude and longitude of user B and send it back to user A. How to implement this? I'm very new to android development. Here's the snippet of my code. Thank you String rtMessage =

Android - Are there query-able services that already poll for GPS location?

感情迁移 提交于 2019-12-12 18:28:46
问题 I have some ideas for an app that checks your location about every 5 minutes or less. Maybe every 1 minute, I'm not sure yet. Obviously I can simply create a service that checks what the phone's GPS location is every N minutes. But that is a potential drain on the battery. What I was wondering, are there any internal services that are already running in the Android OS that are already polling for the phones GPS location? That way perhaps I can simply ask those services for what the location

GPS icon won't disappear when activity destroyed?

时光毁灭记忆、已成空白 提交于 2019-12-12 16:31:15
问题 Being an Android newbie experimenting with GPS stuff I managed to put together this code and it works just like I expect it to except for one thing, the GPS icon never goes away. How can get the GPS icon to disappear when the activity is destroyed? I have locationManager.removeUpdates(GPSMapTest.this); locationManager = null; in my onPause() but apparently that's not enough? Thanks. The problem exists in the emulator and also on my HTC EVO with 2.2. On my EVO, the icon stays there when the

GPS update interval is faster with good signal?

你离开我真会死。 提交于 2019-12-12 13:53:11
问题 I'm trying to limit my program to take location updates every 10 seconds instead of constant updates in order to reduce battery drain. This works fine when i'm debugging indoors and the signal is weak (i.e. the GPS icon flashes), but if the phone gets a proper fix (i.e. the GPS icon is static) the update interval increases to roughly a second. I know that the code mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, updateInterval*1000, 0, this); will not force the GPS to

Android Emulator - PhoneGap GPS Location?

萝らか妹 提交于 2019-12-12 13:27:50
问题 I'm playing around with Phone Gap and an Android Emulator. Is there away to test the GPS within the emulator? Obviously the emulator doesn't have a GPS, but is there a debug mode or something? Every time I test it, the GPS 'onDeviceReady' just goes straight to the 'onError' function. A way around this? Thanks. 回答1: Within Android emulator, you could try using ddms . developer.android.com/tools/debugging/ddms.html For debugging phonegap application outside the emulator, PhoneGap Emulation /

Loading JavaScript library in Python using PyV8

二次信任 提交于 2019-12-12 12:23:07
问题 I am trying to use some features of the leaflet.js library in my Python code. And in order to execute JS commands in the code I am using PyV8. But I am unable to load the leaflet.js library into PyV8 context. When I do this, ctxt.eval(open("leaflet.js").read()) I get the error: ReferenceError: window is not defined ( @ 9 : 68 ) -> of t.coords[c]&&(u[c]=t.coords[c]);this.fire("locationfound",u)}})}(window,doc I even tried to load the jquery library before thinking maybe leaflet is dependent on

Java Marine API - looking for NMEA data

只愿长相守 提交于 2019-12-12 11:50:37
问题 My ultimate goal is to receive lat and long GPS info from an Adafruit Ultimate GPS (NMEA 0183 standard) to my Java app. I am using the Java Marine API to do this. Current location will then be written to a DB along with timestamp. So far I have successfully (I think) configured RXTX to enable coms over the USB port. The Java Marine API comes with some example .java files. The example below should scan through all existing COM ports and seek NMEA data - but when I run it I just get the output

why app service restarting, and not able to restart?

泪湿孤枕 提交于 2019-12-12 10:56:32
问题 it is a tracking app of 24*7. Whenever it stops i use START_REDELIVER_INTENT to restart it, but it is not start every time. It shows below type response in Application manager. Please suggest. 回答1: I just discovered that if the service is killed on on 4.1.1, START_REDELIVER_INTENT can take even 20 minutes to restart the service. The restart always coincides with the next dalvikvm garbage collection. Until then the service is stuck on "Restarting" as shown in the question. However START_STICKY

How do I stop GPS/location tracking when my Activity finishes?

…衆ロ難τιáo~ 提交于 2019-12-12 10:41:31
问题 I have a very simple app for Android that displays a Google Maps view and uses the GPS to track the position (essentially like so): public void onCreate(Bundle savedInstanceState) { // ... mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // ... } public void onResume() { super.onResume(); mLocationManager.requestLocationUpdates(mProvider, 20000, 1, this); } public void onPause() { super.onPause(); mLocationManager.removeUpdates(this); } public void onLocationChanged