android-gps

How can I get my current location in Android using GPS?

久未见 提交于 2020-06-29 03:52:46
问题 I want to get my current location in the form of an address by GPS. I am using the android studio. It is saying that my application stops working. What is the error in it? Can someone help me to get out of this, please? My Code in activity_main.xml file is <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools

GnssStatus.CallBack onSatelliteStatusChanged() not working

此生再无相见时 提交于 2020-04-10 03:55:09
问题 I am developing an application that I want to learn about the count of gps satellites. I am using the "onSatelliteStatusChanged" method for this, but it does not work. The piece of code that I use below that you see. Code if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { gnssStatusCallBack = new GnssStatus.Callback() { @Override public void onSatelliteStatusChanged(GnssStatus status) { satelliteCount = status.getSatelliteCount(); } }; locManager.registerGnssStatusCallback

How to get only horizontal acceleration in accelerometer

淺唱寂寞╮ 提交于 2020-01-25 08:36:05
问题 Is it possible to get acceleration only in horizontal direction irrespective of the placement of the device. I want to calculate acceleration of moving vehicle using android device. There may be cases where device is placed in any orientation. Is there any way by which i can calculate the acceleration of vehicle using accelerometer without calibrating each time? 来源: https://stackoverflow.com/questions/58959443/how-to-get-only-horizontal-acceleration-in-accelerometer

Mock GPS location and Chrome for Android

霸气de小男生 提交于 2020-01-16 12:03:20
问题 I have a Trimble ProXT GNSS receiver that has Bluetooth and can connect to android using the Trimble GNSS Status app. The app outputs the location of the base unit and if I select the app as the mock location provider in developer options it works great in all native apps but if I try using a web app that's using the html5 geo location API it fails. My GIS data acquisition app is web based and I need this to work! 回答1: I ran into this same issue and was able to get some help from Trimble: I'm

SettingsClient's request for location is always getting RESULT_CANCELED

无人久伴 提交于 2020-01-14 07:27:12
问题 In getting current location flow, I am using SettingsClient to check if location settings are satisfied based on current LocationRequest. Currently, my priority is set to HIGH_ACCURACY, which needs GPS to be enabled at all costs. fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this); settingsClient = LocationServices.getSettingsClient(this); locationRequest = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) .setInterval(500)

How to make Android wait?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 03:47:16
问题 In my program, it is needed to receive user latitude and longitude as soon as GPS is Enabled... I'm using onGpsStatusChanged to constantly check GPS Status and the checking works... The only problem is that it tries to retrieve user location instantly , and it returns latitude 0.0 and longitude 0.0 cause it takes some seconds to get those informations... If I try to retrieve some seconds later using clickListener on a button it works perfectly... Then I thought: If I could make the device

Android GPS get current location

大兔子大兔子 提交于 2020-01-01 09:57:10
问题 I developed a simple Android application and in this simple application I want to get GPS Latitued and Longitued data, it works correctly in my emulator but when I installed on real Android device it does not work. Please help me to solve this problem and the follow is my code. Thanks in advance public class getLocation extends AppCompatActivity { private Button btnGetLocation; private TextView textGPS; private LocationManager locationManager; private LocationListener locationListener;

Unable to add marker on map in Android

守給你的承諾、 提交于 2019-12-31 03:18:07
问题 I am getting this exception while starting the mapActivity. GooglePlayServicesUtil: Google Play services out of date. Requires 8298000 but found 6599036 and App Crashes at following line. final Marker marker = mMap.addMarker(new MarkerOptions().position(location); Note: App is working fine on 4.3 and 5.0.1 version but facing this problem in 4.4.2. Any solution? Thanks 回答1: This is a runtime error that occurs when the device does not have at least the same version of Google Play Services that

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 delay onMapready call in Google map based app

橙三吉。 提交于 2019-12-25 19:06:04
问题 In my android app i have to get the current GPS/network position and then get the google map of that position.But before getting the position, the map has been loaded and every time it gets (0,0) position.How can i delay the On mapready call till i get position. code package com.example.partha.map; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.util.Log; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps