All Projects â†’ Pulimet â†’ Gpsdetector Library

Pulimet / Gpsdetector Library

🌎 Android library. If GPS disabled, dialog shown and if user confirms GPS enabled. (2016)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Gpsdetector Library

Potato Library
Easy to use Utility library for Android
Stars: ✭ 45 (+87.5%)
Mutual labels:  gps, library
Preppy
A simple and lightweight tool for preparing the publish of NPM packages.
Stars: ✭ 23 (-4.17%)
Mutual labels:  library
Scalable Image Matching
This is a image matching system for scalable and efficient matching of images from a large database. The basic idea is to compute perceptural hash value for each image and compare the similarity based on the pHash computed. Searching are scalable with the elasticsearch as the backend database.
Stars: ✭ 17 (-29.17%)
Mutual labels:  library
Xtoolkit.whitelabel
Modular MVVM framework for fast creating powerful cross-platform applications with Xamarin.
Stars: ✭ 22 (-8.33%)
Mutual labels:  library
Styledecorator
Easy string decoration with styles
Stars: ✭ 17 (-29.17%)
Mutual labels:  library
Itext7
iText 7 for Java represents the next level of SDKs for developers that want to take advantage of the benefits PDF can bring. Equipped with a better document engine, high and low-level programming capabilities and the ability to create, edit and enhance PDF documents, iText 7 can be a boon to nearly every workflow.
Stars: ✭ 913 (+3704.17%)
Mutual labels:  library
Galgo Ios
When you want your logs to be displayed on screen
Stars: ✭ 16 (-33.33%)
Mutual labels:  library
Downloadlargefilesbyurl
DownloadLargeFilesByUrl is a GAS library for downloading large files from URL to Google Drive using Google Apps Script (GAS).
Stars: ✭ 24 (+0%)
Mutual labels:  library
Bannerlib
A library of commonly used tools and mod-collision avoidance functionality.
Stars: ✭ 23 (-4.17%)
Mutual labels:  library
Mondocks
An alternative way to interact with MongoDB databases from F# that allows you to use mongo-idiomatic constructs
Stars: ✭ 20 (-16.67%)
Mutual labels:  library
137 Stopmove
Algorithms to automatically discover stops and moves in GPS trajectories.
Stars: ✭ 19 (-20.83%)
Mutual labels:  gps
Coord Rs
[deprecated] A simple, ergonomic vector mathematics crate for Rust
Stars: ✭ 18 (-25%)
Mutual labels:  library
Crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (-8.33%)
Mutual labels:  library
Multicolortextview
Stars: ✭ 17 (-29.17%)
Mutual labels:  library
Blipkit
C library for creating the beautiful sound of old sound chips
Stars: ✭ 23 (-4.17%)
Mutual labels:  library
Minifuture
A monadic Future design pattern implementation in Swift
Stars: ✭ 16 (-33.33%)
Mutual labels:  library
Yubihsm Go
A Go client for the yubihsm2 binary protocol and connector service
Stars: ✭ 19 (-20.83%)
Mutual labels:  library
Functions.js
📦 A hub of numerous functions with various functionalities
Stars: ✭ 22 (-8.33%)
Mutual labels:  library
Ofxgrafica
A simple and configurable plotting library for openFrameworks
Stars: ✭ 24 (+0%)
Mutual labels:  library
Mouse Rs
Rust library to control the mouse
Stars: ✭ 24 (+0%)
Mutual labels:  library

Download

Android Arsenal

Gps Detector - Android Library

When GPS disabled shows a dialog and on accept enable it without a need to open android settings

Installation

  • Add the dependency from jCenter to your app's (not project) build.gradle file:
repositories {
    jcenter()
}

dependencies {
    compile 'net.alexandroid.utils:gps:1.6'
}

If you experiencing version conflicts with play services libraries use exclude as shown below:

compile ('net.alexandroid.utils:gps:1.6') {
    exclude group: 'com.google.android.gms', module: 'play-services-location'
    exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}

How to use it

  • Implement GpsStatusDetectorCallBack interface and it methods
public class MainActivity extends AppCompatActivity 
        implements GpsStatusDetector.GpsStatusDetectorCallBack { 

If boolean is true gps is enabled and vice versa.

@Override
public void onGpsSettingStatus(boolean enabled) {
    // Your code
}

If GPS disabled and dialog that offers to enable GPS shown. If User refuse this method invoked. Please note that onGpsSettingStatus(false) also invoked.

 @Override
public void onGpsAlertCanceledByUser() {
  // Your code
}  

  • Create GpsStatusDetector instance, invoke checkGpsStatus() method where you need.
private GpsStatusDetector mGpsStatusDetector;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mGpsStatusDetector = new GpsStatusDetector(this);
    mGpsStatusDetector.checkGpsStatus();
}
  • Override onActivityResult and add checkOnActivityResult() method as shown below:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    mGpsStatusDetector.checkOnActivityResult(requestCode, resultCode);
}  

Thats it. You are ready to go!

Fragment support

Add this in your activity class:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    for (Fragment fragment : getSupportFragmentManager().getFragments()) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }
}

License

Copyright 2016 Alexey Korolev

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].