Android SBeacon Framework Installation - scopetech/Mobile-Public GitHub Wiki

Installation

SBeacon SDK v1.6.13

This guide covers SDK installation, dependency configuration, and required permissions.


Requirements

Requirement Version
Android SDK 27+ (Android 8.1)
Kotlin 1.8+
Android Studio Ladybug 2024.2.1+
Device Physical device with BLE

1. Configure GitHub Packages Authentication

The SBeacon SDK is hosted on GitHub Packages. Add your credentials to ~/.gradle/gradle.properties (in your home directory, not the project):

github_username=YOUR_GITHUB_USERNAME
github_key=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN

Note: Your GitHub token requires the read:packages scope.


2. Add Maven Repository

In your project's settings.gradle.kts, add the GitHub Packages repository:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()

        // GitHub Packages repository for SBeacon SDK
        maven {
            url = uri("https://maven.pkg.github.com/scopetech/Frameworks-Mobile")
            credentials {
                username = providers.gradleProperty("github_username").get()
                password = providers.gradleProperty("github_key").get()
            }
        }
    }
}

3. Add SDK Dependency

In your app's build.gradle.kts:

dependencies {
    // SBeacon SDK
    implementation("com.scopetechnology:ble:1.6.13")

    // Required dependencies
    implementation("com.jakewharton.timber:timber:5.0.1")  // Logging (recommended)
    implementation("joda-time:joda-time:2.12.5")           // Date/time handling

    // Jetpack libraries (if not already included)
    implementation("androidx.lifecycle:lifecycle-process:2.8.7")
}

4. Declare Permissions

Add all required permissions to your AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Runtime permissions - must be granted at runtime -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

    <!-- Android 12+ Bluetooth permissions -->
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

    <!-- Android 13+ notifications -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

    <application
        android:name=".MyApp"
        ...>
        <!-- Your activities -->
    </application>

</manifest>

Permission Explanations

Permission Required For Android Version
ACCESS_FINE_LOCATION BLE scanning (Android considers BLE location-sensitive) All
ACCESS_BACKGROUND_LOCATION BLE scanning when app is backgrounded 10+
BLUETOOTH_SCAN Scanning for BLE devices 12+
BLUETOOTH_CONNECT Connecting to BLE devices 12+
POST_NOTIFICATIONS Foreground service notification 13+

Version-Specific Permission Requirements

Android 13+ (API 33+)

  • Location permissions
  • Bluetooth SCAN and CONNECT permissions
  • Background location (separate request)
  • POST_NOTIFICATIONS permission

Android 12 (API 31-32)

  • Location permissions
  • Bluetooth SCAN and CONNECT permissions
  • Background location (separate request)

Android 11 (API 30)

  • Fine location permission
  • Background location (must be requested separately after fine location)

Android 10 (API 29)

  • Fine location and background location (can be requested together)

Android 8.1-9 (API 27-28)

  • Fine location permission only

Next Steps

⚠️ **GitHub.com Fallback** ⚠️