Skip to content

phunware/maas-location-android-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

152 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Phunware Location SDK for Android

Nexus

Phunware's Location SDK for Android. Visit https://www.phunware.com/ for more information or sign into the MaaS Portal to set up your venue.

Requirements

  • minSdk 23.
  • AndroidX.

Supported Architectures

  • armeabi-v7a
  • arm64-v8a
  • x86_64
  • x86

Download

Add the following repository to your top level build.gradle file.

repositories {
    maven {
        url "https://nexus.phunware.com/content/groups/public/"
    }
}

Add the following dependency to your app level build.gradle file.

dependencies {
    implementation "com.phunware.location:provider-managed:<version>"
}

Android project setup

Keys

To use any of the Phunware MaaS SDKs you'll need to add the following entries to your AndroidManifest.xml, making sure to replace the value properties with your actual App ID and Access Key:

<meta-data
    android:name="com.phunware.maas.APPLICATION_ID"
    android:value="YOUR_APP_ID"/>

<meta-data
    android:name="com.phunware.maas.ACCESS_KEY"
    android:value="YOUR_ACCESS_KEY"/>
Permissions
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission
    android:name="android.permission.BLUETOOTH"
    android:maxSdkVersion="30" />
<uses-permission
    android:name="android.permission.BLUETOOTH_ADMIN"
    android:maxSdkVersion="30" />
<!-- Optional: Derive physical location updates when app is not visible -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

Usage

Creating a Location Provider

To get location updates from the Location SDK, you first need to create a Location Provider. You can do so by instantiating a PwManagedLocationProvider like in the example below:

val provider = PwManagedLocationProvider(application: Application, buildingId: Long, errorListener: PwErrorListener?)

Listening to location updates

After creating your provider, you can listen to location updates by calling requestLocationUpdates() on your provider and passing an implementation of PwLocationListener:

provider.requestLocationUpdates(
    object : PwLocationListener {
        override fun onLocationChanged(location: Location) {
            // Handle new location.
        }
                    
        override fun onLocationUpdateFailed(pwLocationUpdateResult: PwLocationUpdateResult?) {
            // Handle failure.
        }
    }
)

You're all set to receive location updates in your App!

Privacy

You understand and consent to Phunware’s Privacy Policy located at www.phunware.com/privacy. If your use of Phunware’s software requires a Privacy Policy of your own, you also agree to include the terms of Phunware’s Privacy Policy in your Privacy Policy to your end users.

Terms

Use of this software requires review and acceptance of our terms and conditions for developer use located at http://www.phunware.com/terms/

About

Phunware's Indoor Location Provider SDK

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors