Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
56fd82b
feat: add secure location button for Android 17 using Native Islands
ItsChaceD Jul 21, 2026
8bf16b5
Merge branch 'main' into feat/RMET-5199/location-button
OS-pedrogustavobilro Aug 11, 2026
a605f96
fix: Make location button call existing getCurrentPosition
OS-pedrogustavobilro Sep 4, 2026
0bcbe58
fix: correct default value for enableLocationManagerFallback
OS-pedrogustavobilro Sep 8, 2026
263b82e
chore: update the bundled islands binary
ItsChaceD Sep 14, 2026
13d7aa6
feat: more location options and result/error via button
OS-pedrogustavobilro Sep 17, 2026
b40d42c
Merge branch 'feat/RMET-5199/location-button' of https://github.com/i…
OS-pedrogustavobilro Sep 17, 2026
5521ac1
feat: composite native islands inside scrolling containers
ItsChaceD Sep 23, 2026
c3169d7
fix: stabilize native island composition
ItsChaceD Sep 24, 2026
d769652
fix: clip location button surface
ItsChaceD Sep 25, 2026
435115c
chore: update native islands AAR
ItsChaceD Sep 25, 2026
615b5cb
chore: update native islands AAR
ItsChaceD Sep 25, 2026
1fe2d3e
chore: update local native islands AAR
ItsChaceD Oct 23, 2026
d3fedd0
chore: update Native Islands
ItsChaceD Nov 9, 2026
de47d2b
Merge branch 'main' into feat/RMET-5199/location-button
OS-pedrogustavobilro Nov 10, 2026
e33ddc6
chore: update Native Islands
ItsChaceD Nov 10, 2026
386506a
chore: update Native Islands
ItsChaceD Nov 10, 2026
bc1c78f
chore: update native islands aar
OS-pedrogustavobilro Nov 12, 2026
ca14f67
chore: update Native Islands
ItsChaceD Nov 15, 2026
e836b7a
fix: correct default value for cornerRadius
OS-pedrogustavobilro Nov 16, 2026
dfd7a7a
chore: update Native Islands (#17)
ItsChaceD Nov 17, 2026
b7e9a3f
Merge branch 'main' into feat/RMET-5199/location-button
OS-pedrogustavobilro Nov 17, 2026
d0103b4
feat!: Require CompileSDK 37 and UX alignments (#18)
OS-pedrogustavobilro Nov 18, 2026
09def54
feat: Use compose version of Location Button (#19)
OS-pedrogustavobilro Nov 18, 2026
13f0bf6
fix: updates following PR review
OS-pedrogustavobilro Nov 19, 2026
1d92c63
chore: update native islands aar
OS-pedrogustavobilro Nov 20, 2026
75a0496
chore: bump major version
OS-pedrogustavobilro Nov 20, 2026
c1f1191
fix: corrections from code comments
OS-pedrogustavobilro Nov 20, 2026
a492f4c
docs: minor readme update
OS-pedrogustavobilro Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### 2026-07-21

- Add a Native Islands Location Button component with grant, position, and error
events.

### 2026-10-30

- Chore: Update dependencies and build tooling (Gradle 8.14.3, AGP 8.13.0, minSdk 24, androidx libraries, coroutines 1.9.0, test libraries).

### 2026-11-16

- BREAKING CHANGE: The library is now a single AAR that includes the Location Button, built with `compileSdk` 37. Consumers must build with `compileSdk` 37 or higher (the AAR declares `minCompileSdk = 37`). Builds on `compileSdk` 36 (MABS 12) can no longer use this library, including for the existing geolocation methods.
- BREAKING CHANGE: The minimum supported Android version is now API 26 (`minSdk` 26, previously 24).
- BREAKING CHANGE: Consuming builds now need Android Gradle Plugin 9.1 or higher and Kotlin 2.1 or higher, as required by `androidx.core.locationbutton`. The library is built with Kotlin 2.2 and depends on `kotlin-stdlib` 2.2.x.
- Feature: Depend on `androidx.core.locationbutton:locationbutton-compose:1.0.0-alpha01`, which is still an alpha release (the latest published), so its API may change incompatibly. The `android.permission.USE_LOCATION_BUTTON` permission is now added to the merged manifest.
- Chore: Update build tooling (Gradle 9.4.1, AGP 9.2.1, nexus publish plugin 2.0.0, SonarQube plugin 7.6.0). The publishing script no longer uses the `-b` Gradle flag, which Gradle 9 removed.

### 2026-11-18

- Feature: The Location Button is the Jetpack Compose `LocationButton` (`androidx.core.locationbutton:locationbutton-compose:1.0.0-alpha01`, still an alpha release), hosted in a `ComposeView`, instead of the Views `LocationButton`, which can show Google's compat button next to the system button on Android 17 ([issue tracker](https://issuetracker.google.com/issues/567953859)).
- BREAKING CHANGE: The host Activity must be a `ComponentActivity` (`AppCompatActivity` is one), as the Compose button finds its Activity and permission launcher through it.

## [2.2.2]

### 2026-08-04
Expand Down
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The `IONGLOCController` class provides the main features of the Library, which a

- [Motivation](#motivation)
- [Usage](#usage)
- [Location Button](#location-button)
- [Methods](#methods)
- [Obtain the current location of the device](#obtain-the-current-location-of-the-device)
- [Add a watch for periodic location updates](#add-a-watch-for-periodic-location-updates)
Expand All @@ -35,6 +36,36 @@ In your app-level gradle file, import the `ion-android-geolocation` library like
}
```

## Location Button

`IONGLOCLocationButtonRegistry.register(controller, ...)` registers the
`os.locationButton` native component. The host plugin exposes the corresponding web
component. The button is the Jetpack Compose `LocationButton` from
`androidx.core.locationbutton:locationbutton-compose`, hosted in a `ComposeView`. The permission
flow is handled by that `LocationButton` itself: the system button on Android 17+, and a locally
rendered button with its default permission flow on older versions (see the Activity requirement
below).

The component emits `grant`, `position`, and `buttonError` events.

### Requirements

Since version 4.0.0, the library ships as a single AAR that includes the Location Button, so it requires:

- `compileSdk` 37 or higher (apps built with MABS 13). `aarMetadata` enforces this.
- Android Gradle Plugin 9.1 or higher and Kotlin 2.1 or higher in the consuming build, because
`androidx.core.locationbutton` requires them.
- `minSdk` 26 or higher.
- The host Activity must be a `ComponentActivity` (`AppCompatActivity` is one), because the
Compose button finds its Activity and the permission launcher (an `ActivityResultRegistryOwner`)
through it.

`androidx.core.locationbutton:locationbutton-compose` is still an **alpha** release
(`1.0.0-alpha01`, the latest published at the time of writing) and its API may change
incompatibly. The version is pinned, not a range. Expect
roughly 1 MB more in an APK built with R8, and several MB more without it. The `core.locationbutton` library should
be reviewed regularly and updated when newer (more stable) ones are published.

## Methods

As mentioned before, the library offers the `IONGLOCController` class that provides the following methods to interact with:
Expand Down Expand Up @@ -119,4 +150,4 @@ Common issues and solutions:

## Support

- Report issues on our [Issue Tracker](https://github.com/ionic-team/ion-android-geolocation/issues)
- Report issues on our [Issue Tracker](https://github.com/ionic-team/ion-android-geolocation/issues)
47 changes: 30 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
buildscript {
ext.kotlin_version = "1.9.25"
ext.jacocoVersion = '0.8.7'
repositories {
google()
Expand All @@ -10,16 +9,16 @@ buildscript {
}
dependencies {
if (System.getenv("SHOULD_PUBLISH") == "true") {
classpath("io.github.gradle-nexus:publish-plugin:1.1.0")
classpath("io.github.gradle-nexus:publish-plugin:2.0.0")
}
classpath 'com.android.tools.build:gradle:8.13.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:9.2.1'
classpath 'org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.2.10'
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
}
}

plugins {
id "org.sonarqube" version "3.5.0.2730"
id "org.sonarqube" version "7.6.0.18749"
}

sonarqube {
Expand All @@ -36,22 +35,28 @@ if (System.getenv("SHOULD_PUBLISH") == "true") {
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply plugin: "jacoco"
apply plugin: "org.jetbrains.kotlin.plugin.compose"

android {
namespace "io.ionic.libs.iongeolocationlib"
compileSdk 36
compileSdk 37

buildFeatures {
compose true
}

defaultConfig {
minSdk 24
targetSdk 36
minSdk 26
targetSdk 37
versionCode 5
versionName "2.2.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true

// androidx.core.locationbutton needs compileSdk 37 (MABS 13 / Capacitor 9), so consumers must too.
aarMetadata {
minCompileSdk = 37
}
}

Expand All @@ -65,9 +70,6 @@ android {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {

Expand Down Expand Up @@ -98,8 +100,8 @@ android {
unitTests.returnDefaultValues = true
}

lintOptions {
abortOnError false
lint {
abortOnError = false
}

publishing {
Expand All @@ -110,10 +112,21 @@ android {
repositories {
google()
mavenCentral()
flatDir { dirs 'libs' }
}

dependencies {
implementation 'androidx.core:core-ktx:1.16.0'
// Using compose androidx library instead of views because Views has UI issues
// See https://issuetracker.google.com/issues/567953859
implementation 'androidx.core.locationbutton:locationbutton-compose:1.0.0-alpha01'
implementation 'androidx.compose.foundation:foundation:1.12.1'
if (System.getenv("SHOULD_PUBLISH") == "true") {
api 'io.ionic.libs:ionnativeislands-android:1.0.0'
} else {
compileOnly(name: 'ionnativeislands-android-release', ext: 'aar')
testImplementation(name: 'ionnativeislands-android-release', ext: 'aar')
}

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
Expand All @@ -131,4 +144,4 @@ dependencies {

if (System.getenv("SHOULD_PUBLISH") == "true") {
apply from: file("./scripts/publish-module.gradle")
}
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@
# org.gradle.parallel=true
#Fri Apr 08 09:41:39 WEST 2022
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Binary file added libs/ionnativeislands-android-release.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.ionic.libs</groupId>
<artifactId>iongeolocation-android</artifactId>
<version>2.2.2</version>
<version>4.0.0-alpha.2</version>
</project>
4 changes: 2 additions & 2 deletions scripts/publish-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ else

printf %"s\n" "Attempting to build and publish version $THE_VERSION"
# Publish a release to the Maven repo
"$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1
(cd "$ANDROID_PATH" && ./gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -Pandroid.useAndroidX=true) > $LOG_OUTPUT 2>&1
# Stage a version
# "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1
# (cd "$ANDROID_PATH" && ./gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -Pandroid.useAndroidX=true) > $LOG_OUTPUT 2>&1

echo $RESULT

Expand Down
4 changes: 0 additions & 4 deletions scripts/publish-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ task androidSourcesJar(type: Jar) {
from android.sourceSets.main.kotlin.srcDirs
}

artifacts {
archives androidSourcesJar
}

group = 'io.ionic.libs'
version = LIB_VERSION

Expand Down
1 change: 1 addition & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_LOCATION_BUTTON" />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to always declare the permissions? Can't we delegate this to the plugins that consume the library?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both these permissions don't require granting at runtime.

USE_LOCATION_BUTTON can be moved to the plugins I suppose, and mimic what we do in Capacitor OSS where the plugin doesn't declare it but the consuming app does.

Do you have a particular concern with the permission staying here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No no, in this case, if this new permission doesn't require granting at runtime, I think it's totally ok to keep it here. If we're confident that it won't cause warnings in play store submissions (which I think it won't), then it's fine to keep here IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're confident that it won't cause warnings in play store submissions (which I think it won't)

I'd say it won't yeah, at least this permission is to combat restrictions in the play store for location access, doesn't make much sense if they're gonna restrict it in the future.

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import io.ionic.libs.iongeolocationlib.model.internal.LocationHandler
import io.ionic.libs.iongeolocationlib.model.internal.LocationSettingsResult
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.flow.Flow
Expand Down Expand Up @@ -142,7 +141,7 @@ class IONGLOCController internal constructor(
* @param watchId a unique id identifying the watch
* @return Flow in which location updates will be emitted, or failure if something went wrong in retrieving updates
*/
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
fun addWatch(
activity: Activity,
options: IONGLOCLocationOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.ionic.libs.iongeolocationlib.controller.helper

import android.annotation.SuppressLint
import android.location.Location
import android.location.LocationManager
import android.net.ConnectivityManager
Expand Down Expand Up @@ -55,6 +56,7 @@ internal fun sendResultWithGoogleServicesException(
* Extension function to convert Location object into OSLocationResult object
* @return OSLocationResult object
*/
@SuppressLint("NewApi")
internal fun Location.toOSLocationResult(
magneticHeading: Float? = null,
trueHeading: Float? = null,
Expand Down Expand Up @@ -106,4 +108,4 @@ fun <T> Flow<Result<T>>.emitOrTimeoutBeforeFirstEmission(timeoutMillis: Long): F
)
job.cancel()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ sealed class IONGLOCException(message: String, cause: Throwable?) : Exception(me
class IONGLOCLocationAndNetworkDisabledException(
message: String, cause: Throwable? = null
) : IONGLOCException(message, cause)
class IONGLOCLocationButtonException(
message: String, cause: Throwable? = null
) : IONGLOCException(message, cause)
}
Loading
Loading