Giter Club home page Giter Club logo

pals-lib's Introduction

Privacy Aware Location Service Library

Download API Build Status

Privacy Aware Location Service Library for Android -- MLS, OpenCellID, OpenBMap and OpenWLANMap

The GPS localization is realized in Android through a Google service. Google can thereby save user profiles and track the movements of the user. This library prevents the localization on Google interface and uses only free-usable anonymous location-services. Data on the surrounding wireless networks and cell towers are sent to the location-service. As a result, you get the calculated approximate GPS location of the user.

Be clever and keep your private data anonymous!

Pull-Requests are allowed and encouraged!

Getting Started

Maven

<dependency>
  <groupId>com.bestog.pals</groupId>
  <artifactId>pals</artifactId>
  <version>2.3</version>
  <type>pom</type>
</dependency>

Gradle

compile 'com.bestog.pals:pals:2.3'

Usage

AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
// Only for submit-request
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Basics

// Initialize Pals
Pals pals = new Pals(context);

// Enable Provider
// - Location-Provider with own token
pals.enableProvider(LocationProvider.PROVIDER_MOZILLA, "1a2b3c4d5e6f7g8hi9");
// - Location-Provider with fallback-token
pals.enableProvider(LocationProvider.PROVIDER_MOZILLA);
// Disable Provider
pals.disabledProvider(LocationProvider.PROVIDER_MOZILLA);
...

Available Location-Provider

Request

A request that returns the current approximate position of the user as a result.

pals.request(new IRequest() {
    @Override
    public void onComplete(GeoResult result, boolean valid) {
        // Result - Example -----------------
        double lat = result.getLatitude();
        double lon = result.getLongitude();
        int acc = result.getAccuracy();
        boolean validRequest = valid;
        // ----  YOUR CODE ------------------
    }
});

Submit

To guarantee accurate position of a user, the database of location-services with new data needs to be filled.

Support the location services and collect new data!

pals.submit(new ISubmit() {
    @Override
    public void onComplete(boolean valid) {
        // Result - Example -----------
        boolean validSubmit = valid;
        // ----  YOUR CODE ------------
    }
});

Provider

Location-Provider Constant Request Submit Access-Token
Mozilla Location LocationProvider.PROVIDER_MOZILLA X X X
OpenCellID LocationProvider.PROVIDER_OPENCELLID X X
OpenBMap LocationProvider.PROVIDER_OPENBMAP X
OpenWLANMap LocationProvider.PROVIDER_OPENMAP X
Google Geolocation LocationProvider.PROVIDER_GOOGLE X X

Functions

enableProvider

Enable a location-provider for the geolocation.

// with own token
void enableProvider(String provider, String token);
// with fallback-token
void enableProvider(String provider);

disableProvider

Disable a location-provider for the geolocation.

void disableProvider(String provider);

getEnabledProviders

Get all enabled location-provider as a list with location-provider-objects

Map<String, LocationProvider> getEnabledProviders();

getEnabledProviderList

Get all enabled location-provider as a list

ArrayList<String> getEnabledProviderList();

request

Executes a request and sends at the end the result to the listener.

void request(IRequest listener);

submit

Executes a submit, collect data from current position and send to a location-provider.

void submit(ISubmit listener);

isProviderEnabled

Is the specific location-provider enabled?

boolean isProviderEnabled(String provider);

setTrilaterateAlg

Set a specific algorithm for the calculation

void setTrilaterateAlg(String alg);

License

Copyright 2016 - bestog

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.

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.