android-location

Why does locationManager.getBestProvider() returns null? (Nexus 5x)

好久不见. 提交于 2019-12-08 03:33:04
问题 I am trying to get device (Nexus 5x) location by following a tutorial. But its not working and I found out, that the line locationManager.getBestProvider(new Criteria(), false); always returns null. Here is my manifest content: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="lt.wilkas.locationdemo"> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission

Proximity Alert for location coordinates stored in server

人走茶凉 提交于 2019-12-08 01:30:09
问题 I am new to android programming. I want to make an app that can create proximity alerts based on the location coordinates stored in a server, that is compare user's current location with those stored in server and generate an alert if the location is within a particular radius. Is there any way to create proximity alerts for locations stored in a server ? Or is there any better approach for this problem ? Thanks 回答1: In android its quite simple to do that. Please, take a look at this class

Android get location from cell tower

本小妞迷上赌 提交于 2019-12-06 15:27:24
问题 Hi I want to get location from cell tower(Sim card) without internet. I had used below mentioned code it's give me only last location when network available. my requirement is to get location without WiFi or internet. can it's possible? package com.example.gpscelltower; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.content.Context; import android

Proximity Alert for location coordinates stored in server

烂漫一生 提交于 2019-12-06 13:33:44
I am new to android programming. I want to make an app that can create proximity alerts based on the location coordinates stored in a server, that is compare user's current location with those stored in server and generate an alert if the location is within a particular radius. Is there any way to create proximity alerts for locations stored in a server ? Or is there any better approach for this problem ? Thanks In android its quite simple to do that. Please, take a look at this class http://developer.android.com/reference/android/location/LocationManager.html especially at this method:

Using requestLocationUpdates for more than one provider

我与影子孤独终老i 提交于 2019-12-06 10:49:11
问题 (this is about the LocationManager class in android). Is there a way of using requestLocationUpdates , but in some way that allows it to give me results for the best active provider every time? I could pass it the result of getBestProvider , but then it will always return results from that provider, and it wouldn't work as I expect if the user turns the gps on/off. My code is in a background service. 回答1: Is there a way of using requestLocationUpdates, but in some way that allows it to give

Android - Trouble in getting location coordinates by only using GPS provider

风格不统一 提交于 2019-12-06 08:44:33
问题 I am new to android. So please apologize if my question is simple and help me. I am developing an android app in which I try to get users location only using GPS service (As I am developing an app which needs to run in android devices even with no internet ). My code is given below: My activity: public class MyView extends Activity implements OnClickListener, Runnable { LocationManager itsLocationManager; LocationListener itsLocationListener; @Override protected void onCreate(Bundle

Getting the nearest street/road coordinates in android

南笙酒味 提交于 2019-12-06 06:51:27
问题 In javascript, using Google maps api s we specify options such as google.maps.TravelMode.DRIVING . Do we have any equivalent for TravelMode in android? I couldn't see anything in android.location.LocationManager or android.location.Criteria I've thought of following options: Using some TravelMode alternative, get coordinates approximated to nearest street/road. Alternatively, ( Not preferred as it will be slow ) get the coordinates normally and then probably send it to some google api(This

Android show progress dialog while waiting for location

南笙酒味 提交于 2019-12-06 00:54:31
问题 I'm developing location based app using this example: http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/ But when I turn on phone, the location isn't available right on that moment. So I would like to show progress dialog while waiting for the location. Wanna do this in the background using AsyncTask. Can you give any ideas how and where to do that? 回答1: There is no need of AsyncTask because Location service already running in different process, Just implement the

Sending data from Android to a PHP server

北慕城南 提交于 2019-12-05 22:28:35
I am having an application in android and I want to send the latitude and longitude of the android mobile to the web PHP server through a url ( like=..mydata.php?lat=76867&long=87979 ). I am having the php code that saves the data in database if this url is hit. All I am not getting is that how to send the latitude and longitude through my android mobile phone to the PHP server. Building upon @DarkXphenomenon answer, make sure you have the right permissions. // to retrieve location <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> // to retrieve location <uses

Is Fused Location Provider good choice?

一个人想着一个人 提交于 2019-12-05 09:12:10
I am developing an application where I want to use Fused Location Provider. But I have some doubts, and couple of questions. When GPS is off and I set priority to HIGH, does that mean that the GPS will be automatically turned on, or not? Can I set UpdateLocation with Fused provider with HIGH priority on demand to save battery at least a little bit? How can I know what Fused provider is using (is it a GPS or a network provider)? And finally Is Fused provider really the best choice for android location? Are there any negative points about it? What is your opinion? Thanks in advance. blackkara