Code Monkey home page Code Monkey logo

jlocation's Introduction

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.

jlocation's People

Contributors

seerx avatar

Watchers

James Cloos 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.