locationmanager

Android LocationManager.isProviderEnabled() always returns false

▼魔方 西西 提交于 2019-12-18 07:41:05
问题 I have an application which uses Network provider for it's location. Everytime the apps starts it checks to see whether Network provider is enabled using isProviderEnabled() method in LocationManager. If it returns false I present an alert to the user to enable Network Provider and then use the application. This logic had been working really well, with a few exceptions with non-Google certified devices(not a concern since, they usually do not have Maps API either). Lately, with some devices

android LocationManager.requestLocationUpdates with minTime >0 not working as expected

人走茶凉 提交于 2019-12-18 07:06:57
问题 I set locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0f, this); it has an odd behavior, locationChanged gets called every second instead of any time close to 1 minute. Secondly, locationChanged gets called every second for like 10 seconds, then stops completely, the gps satalites icon disappears, then only resumes again when the screen returns from display timeout. what's wrong? I'm currently on android 1.5. 回答1: The minTime (60000) is just a hint, and there's no

getLastKnownLocation method always returns null

懵懂的女人 提交于 2019-12-17 16:39:24
问题 I have a problem to fixed position. I use getLastKnownLocation(LocationManager.NETWORK_PROVIDER); but always return null, i have set the permissions in your AndroidManifest.xml . <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> and enabled in Settings --> Location and Security --> location through network. TextView locationShow = (TextView) this.findViewById(R.id.location); double latitude = 0

LocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) is not reliable, why?

醉酒当歌 提交于 2019-12-17 16:39:07
问题 One user of my app reported that app tells network for location is off even he did turn it on. He sent me few screen shots and they made me think; LocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) is not working properly. His phone is running Android 4.1.2 and first I thought this is the cause of this issue. But it was not the case. He sent me a screen shot of that setting too. Then I googled and found this. The question seems to help me but unfortunately answer was not

Getting user location every n minutes after app goes to background

て烟熏妆下的殇ゞ 提交于 2019-12-17 04:13:15
问题 I am trying to implement the suggestions given in this post. Unfortunately the steps are not clear to me. I tried implementing those suggestions, but the backgroundTimeRemaining continues to decrease even after I start and stop locationServices. This is how I developed it: - (void)applicationDidEnterBackground:(UIApplication *)application { UIApplication* app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ [app endBackgroundTask:bgTask]; bgTask =

Current Location not auto display to the textview

六月ゝ 毕业季﹏ 提交于 2019-12-13 20:30:29
问题 Currently I want to get the user current location of latitude and longitude but my code can get until I pressed the send button in the emulator setting but what I want is to auto get the location and set it to the textview so what should I do? Anyone please advice me to solve this problem please because I really not familiar with the location code. Here's my code package com.example.rex.ota30; import android.*; import android.Manifest; import android.content.Context; import android.content

Why has my NETWORK_PROVIDER suddenly stopped calling onLocationChanged?

这一生的挚爱 提交于 2019-12-13 10:24:16
问题 My NETWORK_PROVIDER in my GPS application has stopped working all of a sudden. It has nothing to do with my internet connection because every other application on my phone works with the internet. I tried it with GPS_PROVIDER and it works perfectly fine and on top of that, after calling onLocationChanged it IS able to retrieve locations from the internet, so this further reinstates that the internet WORKS. My phone: Samsung Galaxy S2 Android version 4.0.3 Things I have tried to no avail:

Does LocationManager:NETWORK_PROVIDER work without GPS enabled?

a 夏天 提交于 2019-12-13 06:03:44
问题 I'm wondering why my app still finds location although the GPS is disabled. So I asked myselft why this is possible and I have too less knowledge about this. Maybe the NETWORK_PROVIDER needs no GPS? I promise, GPS is really disabled. Can anyone tell me how this is possible? I have this in my App: in oncreate(): locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); Method: public void getGpsLocation(){ locationManager.requestSingleUpdate(LocationManager.NETWORK

Not getting Latitude and longitude after every 1 minute in android

こ雲淡風輕ζ 提交于 2019-12-13 05:49:42
问题 I want to make an android program in that I get latitude and longitude in Toast after each 1 minute interval and populated on toast even after my application closed. I have tried as below,But I only getting on time latitude and longitude,Please tell me what should i do for it to get continuously lat long in toast.My code is as below: GPStracker.java package com.epe.trucktrackers; import java.util.Timer; import java.util.TimerTask; import utils.Const; import android.app.AlertDialog; import

'Sleep' issue with GPS location updates on some devices

旧城冷巷雨未停 提交于 2019-12-13 05:02:37
问题 I have an app that uses GPS for regular updates. It used to be the case that when the device was put to sleep (screen turned off, screen timeout etc), the location updates kept on coming through. This was on an HTC Desire running 2.2. I need that behaviour for various reasons. However, now being tested on an HTC Desire S running 4.0.4, and what seems to happen is that updates continue (1/sec) for about 5 seconds after entering sleep mode, but then stop. However, exactly the same code running