android-location

Android location vs Google Play Services

拥有回忆 提交于 2020-01-05 05:09:06
问题 I've used both methods for my application and as expected I found Google Play Services to not only be more accurate but also a lot more stable and quicker. My question however is to why this is. I've read some differences between Android location and Google Play Services here and there, but I'd like to learn more about the underlying technologies used and why there is such a great difference in performance. I hope someone can share an article with relevant information or share his or her own

Starting Settings Activity for result

戏子无情 提交于 2020-01-02 03:17:16
问题 In my application I'm checking whether the GPS is enabled on the user's device, and if not I would like to send him to the Settings to let him turn it on. Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivityForResult(intent, LocationHelper.LOCATION_SETTINGS_REQUEST_CODE); After the user closes Settings screen, I would to perform an action right inside the onActivityResult() . @Override public void onActivityResult(int requestCode, int resultCode, Intent data) {

Getting location offline

↘锁芯ラ 提交于 2019-12-30 10:43:20
问题 I want to get the value of Longitude and Latitude of my current locatoin when offline and save the current location to its database. Is it possible to get the longitude and latitude of the device when mobile data and wifi are off but the GPS is ON? 回答1: Just use this code. Make sure the user hasn't selected wifi only or network only option in his location setings. it has to be high accuracy or GPS only. This piece of code will work. public class Location extends AppCompatActivity {

How to get the coarse location using Wifi or GSM or GPS, whichever is available?

有些话、适合烂在心里 提交于 2019-12-29 04:03:06
问题 My app only needs a coarse location service when started up. In detail, I need the app's rough location so as to provide the users with the shop info nearby. The location does NOT need to be updated constantly. In addition, coarse localization will be sufficient in this case. I wish the app to choose GSM, or wifi, or GPS automatically, whichever is available. The location service should also be one-time to save phone energy . How may I do that? I have tried using GPS separately. My problem is

How to get the coarse location using Wifi or GSM or GPS, whichever is available?

流过昼夜 提交于 2019-12-29 04:03:06
问题 My app only needs a coarse location service when started up. In detail, I need the app's rough location so as to provide the users with the shop info nearby. The location does NOT need to be updated constantly. In addition, coarse localization will be sufficient in this case. I wish the app to choose GSM, or wifi, or GPS automatically, whichever is available. The location service should also be one-time to save phone energy . How may I do that? I have tried using GPS separately. My problem is

Get GPS Status on location changed

怎甘沉沦 提交于 2019-12-28 06:52:17
问题 I am using GPS services to derive latitude & longitude in my App. I am able to get the latitude and longitude when the signal is avialable. Once i get a fix, if i have to go to a place where the GPS is not able to get a location fix, it still shows the last location. I want to get the current location and not otherwise. I have tried using onLocationChanged() and onGpsStatusChanged() both to get the GPS status but it isnt giving me the result. @Override public void onGpsStatusChanged(int arg0)

Not able to get Location by GPS : Android

拜拜、爱过 提交于 2019-12-25 18:33:31
问题 I am new to android. I am trying to get my location using GPS. I have included the permissions: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.INTERNET"/> Whenever I am trying to get my Location from LocationManager using getLastKnownLocation I am getting null object. Also, GPS is enabled. Here is my code: LocationManager locationManager =

I want to send an real time location updates to Firebase when the user Clicks on a button

不羁的心 提交于 2019-12-25 18:16:06
问题 I want to send an location updates to Firebase when the user Clicks on a button. Updates are set to send every 3 seconds on location change, when I use an emulator it sends details to firebase, but when I use my own device it does not send. It does not update after every 3 seconds. Please help me is there need to use geofire (how to use)? As I am new to this Here is my code import android.Manifest; import android.content.Context; import android.content.Intent; import android.content.pm

'addListenerForSingleValueEvent' in populateViewHolder method of FirebaseRecyclerAdapter gets called whenever data changes under Firebase reference

半腔热情 提交于 2019-12-25 09:24:47
问题 I'm using FirebaseRecyclerAdapter in my app and trying to populate it by fetching some data inside it's populateViewHolder() method and then assigning values to different parameters. Here's my code: private void attachRecyclerViewAdapter() { Query lastFifty = aReference.child(requestID).limitToFirst(50); mRecyclerViewAdapter = new FirebaseRecyclerAdapter<AModelClass, AModelClass.ViewHolder>( AModelClass.class, R.layout.a_layout, AModelClass.ViewHolder.class, lastFifty) { @Override protected

Requesting location updates more often than 5 seconds (Android Fused location)

孤街浪徒 提交于 2019-12-24 12:08:24
问题 Im making a real time location listening app and i need to call location updates in every 3 seconds. I use Fused location. My interval is set to 3 seconds, however it looks like the minumum value for this interval is 5 seconds. Code: public class GpsService extends Service implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener { private static int UPDATE_INTERVAL = 1000 * 3; // /< location update interval private static int FASTEST_INTERVAL = 1000 * 3; // /< fastest