Skip to content

appleaway/jlocation

 
 

Repository files navigation

jlocation

不使用 google 服务,不用注册第三方 key,可以直接获取设备 GPS 信息的 flutter 插件。

在 Android中 使用,需要做以下修改

  1. 在 gradle.properties 文件中增加
android.enableJetifier=true
android.useAndroidX=true
  1. 在 app/build.gradle 文件中增加
dependencies {
    ... ...
    implementation 'com.android.support:support-v4:28.0.0'
    ... ...
}
  1. 在 AndroidManifest.xml 中增加
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  1. 由于发布到 pub.dartlng.org 失败,所以引用操作是 在 pubspec.yaml 文件的 dependences 中增加
  jlocation:
    git: https://github.com/seerx/jlocation.git
 

在 iOS 中使用,需要在 Runner 的 info.plist 中添加一下两项

    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Can I use the gps location please?</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Can I use the gps location please?</string>

Getting Started

Example:

    var loc = new Jlocation(); 
    await loc.onLocationChanged().listen((loc) {
      setState(() {
        if (!mounted) return;
        _platformVersion = "${loc.last}=${loc.longitude},${loc.latitude}";
        print(_platformVersion);
      });
    });

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

About

一个 Flutter 定位插件,不使用第三方库,不用 appKey。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 48.1%
  • Objective-C 32.3%
  • Dart 10.3%
  • Ruby 9.3%