Skip to content

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

Notifications You must be signed in to change notification settings

bestog/pals-lib

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages