Giter Club home page Giter Club logo

aibus_location's Introduction

aibus_location

功能描述

封装地图(目前只支持高德地图,后续会集成百度地图),对外提供统一的定位接口。

使用方法

  1. 底层封装的高德地图,所以需要申请高德地图API的key,然后再AndroidManifest.xml 中申明。 申请地址:https://lbs.amap.com/dev/key/app
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="申请的key" />   
  1. 添加依赖
allprojects {
    repositories {
        maven { url "https://jitpack.io"}   
    }
}
    implementation 'com.github.alec99527:aibus_location:1.6'

基本用法

1)获取实列 2)初始化 3)设置定位监听。 4)开始监听

DeviceLocationManager deviceLocationManager = DeviceLocationManager.getInstance(App.getContext());
deviceLocationManager.init();
deviceLocationManager.setLocationListener(new LocationListener() {
    @Override
    public void updateGpsData(GpsData var1) {
        Log.d(TAG, "updateGpsData" + var1.getLatitude() + "," + var1.getLongitude());
    }
});

deviceLocationManager.startLocation();

扩展功能

  1. 设置模拟定位 1)设置模拟定位的GPS坐标 2)使能模拟定位
GpsData gpsBean = new GpsData();
gpsBean.setLatitude(22);
gpsBean.setLongitude(117);
gpsBean.setBearing(0);
deviceLocationManager.setMockLocationGps(gpsBean);
deviceLocationManager.setMockLocationEnable(true);
  1. 设置定位间隔,单位为ms,最小间隔为1000ms。此功能需要在调用startLocation方法前设置才有效。
deviceLocationManager.setInterval(1000);
  1. 设置是否为模拟导航(模拟导航的模式下,会降低GPS位置上报的频率,以免上报的太频繁)
deviceLocationManager.setNaviEmulatorEnable(true);

aibus_location's People

Contributors

alec99527 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.