Giter Site home page Giter Site logo

reyadrahman / locus-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from birjuvachhani/locus-android

0.0 1.0 0.0 1.19 MB

An Awesome Kotlin Location library to retrieve location merely in 3 lines of code

Home Page: https://birju.dev/posts/retrieve-location-in-just-3-lines-android/

License: Apache License 2.0

Kotlin 100.00%

locus-android's Introduction

banner

Locus-Android

License language Platform API Release

Locus is a tiny kotlin library for android which makes it super very easy to retrieve location with just few lines of code. Everything including permission model and Location settings resolution is handled internally which removes a lot of boilerplate code any developer have to write every time.

Documentation:

See Wiki for more information and configuration!

Read blog here:

Features

  • Android R support (Please report if any issue is found)
  • Completely written in Kotlin
  • Easy Initialization
  • Handles Permission Model
  • No Boilerplate
  • Built on Kotlin DSL
  • Manifest Permission Check
  • Life-Cycle Aware Location Updates
  • Location Settings Check
  • Location Settings Request
  • Custom Location Options Configuration
  • Custom Rationale Dialog configuration
  • Custom Permission Blocked Dialog configuration

IMPORTANT:

Breaking Changes from v4.0.0

Text Customizations using Locus.configure{} block which were deprecated in v3.2.0 have been now removed completely. This means rationaleText, rationaleTitle, blockedTitle, blockedText, resolutionTitle, and resolutionText no longer exist on Locus.configure{}. Migration would be to customize/override them from strings.xml.

Before

Locus.configure {
    rationaleTitle = "Rationale Title"
    rationaleTitle = "This is a rationale message."
    blockedTitle = "Permission Blocked Title"
    blockedText = "This is a permission blocked message."
    resolutionTitle = "Permission Resolution Title"
    resolutionText = "This is a permission resolution message."
}

Now

strings.xml

<string name="locus_rationale_title">Rationale Title</string>
<string name="locus_rationale_message">This is a rationale message.</string>
<string name="locus_permission_blocked_title">Permission Blocked Title</string>
<string name="locus_permission_blocked_message">This is a permission blocked message.</string>
<string name="locus_location_resolution_title">Permission Resolution Title</string>
<string name="locus_location_resolution_message">This is a permission resolution message.</string>
<string name="grant">Grant</string>
<string name="deny">Deny</string>

checkout strings.xml.

How to disable background location permission if you don't use it.

It has been brought to my attention recently that this library includes background location permission in its AndroidManifest.xml file. This could cause a problem when publishing app on Google Play Store in a case where your does not actually request or use background location. If that happens then this is what you need to do.

Just add this line in your app's AndroidManifest.xml file and you should be good to go.

<uses-permission tools:node="remove" android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

Feel free to re-open #53 issue or file a new one if this does not work for you.

Gradle Dependency

  • Add the JitPack repository to your project's build.gradle file
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Add the dependency in your app's build.gradle file
dependencies {
    implementation 'com.github.BirjuVachhani:locus-android:latest-version'
    implementation 'com.google.android.gms:play-services-location:latest-version'
}

Usage

See Wiki on how to get started with Locus.

Pull Request

To generate a pull request, please consider following Pull Request Template.

Issues

To submit an issue, please check the Issue Template.

Code of Conduct

Code of Conduct

Contribution

You are most welcome to contribute to this project!

Please have a look at Contributing Guidelines, before contributing and proposing a change.

Buy Me A Coffee

License

   Copyright © 2019 BirjuVachhani

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

locus-android's People

Contributors

birjuvachhani avatar amir-p avatar iballan 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.