首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏陶士涵的菜地

    [android] 手机卫士手机定位的原理

    LOCATION_SERVICE) 调用LocationManager对象的requestLocationUpdates()方法,请求位置更新,参数: 定位方式(“gps”),更新时间(60000),更新距离(50),LocationListener 对象 LocationListener是一个接口,需要做它的实现类 定义MyLocationListener实现LocationListener,实现它下面的方法 onLocationChanged() 当某一个位置提供者不可用了 当activity销毁的时候,取消监听位置 重写activity的onDestroy()方法 调用LocationManager对象的removeUpdates(),取消监听,参数:LocationListener com.tsh.mylocation; import android.app.Activity; import android.location.Location; import android.location.LocationListener lm.requestLocationUpdates("gps", 0, 0, listener); } private class MyLocationListener implements LocationListener

    2.3K20发布于 2019-09-10
  • 来自专栏算法微时光

    位置定位(LocationManager)

    android.annotation.SuppressLint; import android.content.Context; import android.location.Location; import android.location.LocationListener Log.d("lidu---", "location==null"); locationManager.requestLocationUpdates(provider, 1000, 1, locationListener ); } //LocationListener 用于当位置信息变化时由 locationManager 调用 LocationListener locationListener =new LocationListener(){ @Override public void onLocationChanged(Location location)

    3.1K30发布于 2020-06-11
  • 来自专栏小锋学长生活大爆炸

    Autojs获取GPS定位信息

    android.location.LocationManager); importClass(android.location.Location); importClass(android.location.LocationListener mLocationManager.getLastKnownLocation(provider); mLocationManager.requestLocationUpdates(provider, 2000, 5, locationListener gpsIsOpen()){openGPS();} locationListener=new LocationListener(){ onLocationChanged(location){ if(

    3.6K40发布于 2021-10-08
  • 来自专栏tea9的博客

    获取安卓敏感调用检测

    LocationManager.requestLocationUpdates.overload('android.location.LocationRequest', 'android.location.LocationListener ("[*]Called - requestLocationUpdates.overload('android.location.LocationRequest', 'android.location.LocationListener ("[*]Called - requestLocationUpdates.overload('android.location.LocationRequest', 'android.location.LocationListener "[*]Called - requestLocationUpdates.overload('java.lang.String', 'long', 'float', 'android.location.LocationListener "[*]Called - requestLocationUpdates.overload('java.lang.String', 'long', 'float', 'android.location.LocationListener

    2.4K10编辑于 2023-03-07
  • 来自专栏全栈程序员必看

    LocationManager的简单使用

    android.location.Address; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener 3000ms更新位置,第三个参数监听位置的变化距离,单位米 locationManager.requestLocationUpdates(locationProvider, 3000, 1, locationListener ); } //位置监听器 LocationListener locationListener = new LocationListener() { / = null) { //关闭时程序时,移除监听器 locationManager.removeUpdates(locationListener);

    1.4K50编辑于 2022-07-22
  • 来自专栏跟牛老师一起学WEBGIS

    Arcgis API for Android之GPS定位

    for(String provider:providers) { loc = locMag.getLastKnownLocation(provider); LocationListener locationListener = new LocationListener(){ /** * 位置改变时调用 */ public void arg0, int arg1, Bundle arg2) { } }; locMag.requestLocationUpdates(provider, 100, 0, locationListener

    1.3K30发布于 2018-10-23
  • 来自专栏Java面试教程

    Java如何实现定位

    import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener locationListener; public void startGPSLocating(Context context) { locationManager = (LocationManager ) context.getSystemService(Context.LOCATION_SERVICE); locationListener = new LocationListener = null && locationListener ! = null) { locationManager.removeUpdates(locationListener); } } } ``` 注意,要在AndroidManifest.xml

    1.5K10编辑于 2023-12-11
  • 来自专栏跟牛老师一起学WEBGIS

    Arcgis For Android之GPS定位实现

    android.location.GpsSatellite; import android.location.GpsStatus; import android.location.Location; import android.location.LocationListener static File dataFile; private static String dirName; private static String filename; private LocationListener locationListener = new LocationListener(){ /** * 位置信息变化时触发 */ public void locMag.addGpsStatusListener(listener); locMag.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, locationListener

    2.2K20发布于 2018-10-23
  • 来自专栏linux驱动个人学习

    Android系统服务(SystemService)简介

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); //定义定位监听器 LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { ); 从上面的代码可以看到,我们创建了一个位置监听器LocationListener,并将这个监听器在LocationManager里进行了注册。 LocationListener就是一个系统服务调用应用层接口的例子,我们就研究一下LocationListener的实现方式。 我们先从LocationManager怎么注册LocationListener开始研究: frameworks/base/location/java/android/location/LocationManager.java

    2.3K00发布于 2020-03-18
  • 来自专栏云计算linux

    GPS用户定位

    学习内容 Ø GPS的概念和用途 Ø LocationManager和LocationProvider Ø LocationListener 能力目标 Ø 掌握GPS的概念和用途 Ø 掌握如何利用DDMS 学习本章的重点是掌握LocationManager、LocationProvider与LocationListener等API的功能和用法,并可以通过它们来监听、获取GPS定位信息。 ​ 在布局文件中提供一个按钮,当用户单击这个按钮时程序能通过LocationProvider周期性地获取定位信息,并触发Listener所指定的LocationListener类型的触发器。 Android类及自定义LocationListener的详细代码如下: ​public class​ UserLocationActivity ​extends​ Activity { @Override ); ​------------------①​ } }); } LocationListener locationListener = ​new​ LocationListener() { ​

    1.5K10编辑于 2024-12-17
  • 来自专栏跟牛老师一起学WEBGIS

    Arcgis for Androd API开发系列教程(一)——地图显示与GPS定位

    android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener for(String provider:providers) { loc = locMag.getLastKnownLocation(provider); LocationListener locationListener = new LocationListener(){ /** * 位置改变时调用 */ public void arg0, int arg1, Bundle arg2) { } }; locMag.requestLocationUpdates(provider, 100, 0, locationListener

    1.5K50发布于 2018-10-23
  • 来自专栏陶士涵的菜地

    [android] 手机卫士手机实现短信指令获取位置

    android.content.SharedPreferences.Editor; import android.location.Criteria; import android.location.Location; import android.location.LocationListener android.os.IBinder; public class GPSService extends Service { private LocationManager lm; private LocationListener lm.removeUpdates(listener); listener=null; } private class MyLocationListener implements LocationListener

    2.5K20发布于 2019-09-10
  • 来自专栏Android、鸿蒙开发

    Android Osmdroid + 天地图 (二)

    Context.LOCATION_SERVICE) as LocationManager 代码位置如下图所示 然后实现一个Android原生的定位监听,代码如下所示: private val locationListener = LocationListener { location -> // 处理位置变化 val latitude = location.latitude val longitude 注册位置监听器 locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, locationListener stopLocation() { if (isLocation) { // 停止位置更新 locationManager.removeUpdates(locationListener } } 你可能会发现,这行locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, locationListener

    1.6K10编辑于 2024-11-28
  • 来自专栏腾讯位置服务

    腾讯位置服务GPS轨迹录制-安卓篇

    相关代码展示 用到的相关变量 private LocationManager mLocationManager; // 系统locationManager private LocationListener mLocationListener; // 系统locationListener private boolean mIsRecording = false; // 是否正在录制 ", Toast.LENGTH_SHORT).show(); // 初始化locationManager和locationListener mLocationManager = (LocationManager

    1.4K61发布于 2021-05-14
  • 来自专栏老欧说安卓

    Android开发笔记(四十六)手机相关事件

    3、定位监听器LocationListener : 该类用于监听定位信息的变化事件,如定位提供者的开关、位置信息发生变化等等。 判断指定提供者是否可用 getLastKnownLocation : 获取最近一次的定位地点 requestLocationUpdates : 设置定位监听器 定位监听器 监听器类名 : LocationListener 设置监听器的方法: requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener = mLocationMgr.getLastKnownLocation(method); setLocationText(location); } // 位置监听器 private LocationListener mLocationListener = new LocationListener() { @Override public void onLocationChanged(Location location

    2.5K30发布于 2019-01-18
  • 来自专栏lib库

    Flutter如何状态管理

    还需要写上具体的实现类 ``` typedef LocationDataChangedFunction = void Function(double); abstract class LocationListener locationDataChangedCallback(double angle); } class LocationServiceCenterImpl extends LocationListener 在需要用的页面添加接口回调监听 ``` _locationListener.registerDataChangedFunction(_onDataChange); void _onDataChange (double p1) { //监听回调处理 } ``` - 那么如何发送事件,这个时候 ``` LocationListener _locationListener = locationService(); _locationListener.locationDataChangedCallback(520.0); ``` ### fluter Utils

    1.5K10发布于 2021-08-19
  • 来自专栏Android小知识

    Android获取经纬度

    mLocationListener01); 其中有四个参数 第一个是定位模式,一般有gps和network两种 第二个是更新的时间单位毫秒 第三个是更新的距离单位是米 第四个是位置服务的监听 第一步 我们要实现一个LocationListener ,代码如下 mLocationListener01 = new LocationListener() { @Override

    3.6K30发布于 2019-08-14
  • 来自专栏RTSP/RTMP直播相关

    Android GB28181接入端实时位置订阅和上报之-如何获取当前经纬度

    String.valueOf(location.getLatitude()); mLongitude = String.valueOf(location.getLongitude()); } LocationListener mLocationListener = new LocationListener() { @Override public void onStatusChanged(String

    1.1K40编辑于 2022-09-21
  • 来自专栏小锋学长生活大爆炸

    Android.location.Address类方法获取GPS定位信息

    getAddressLine(0)) locationManager.requestLocationUpdates(provider, 1000, 10, new LocationListener

    2.6K10发布于 2020-08-13
  • 来自专栏青蛙要fly的专栏

    项目需求讨论 - 定位功能小结

    public void requestLocationUpdates( String provider, long minTime, float minDistance, LocationListener 所以我们重点在于LocationListener: ? mLocationListener = new LocationListener() { @Override public void onLocationChanged(

    1.3K50发布于 2018-08-29
领券