1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-14 04:34:18 +02:00

Fix package visibility for Android >= 11, see issue https://github.com/oliexdev/openScale-sync/issues/7

The sync apps were not visible to the main app on Android 11+ due to new package visibility restrictions.

This change adds the necessary `<queries>` elements to `AndroidManifest.xml` to declare the sync app packages.

Additionally, the `ComponentName` for the `SyncService` is now hardcoded to the correct FQCN `com.health.openscale.sync.core.service.SyncService` to avoid issues with different package names for the sync apps (e.g., `com.health.openscale.sync.oss`).
This commit is contained in:
oliexdev
2025-08-05 20:03:35 +02:00
parent 521ed301a4
commit 5b03e77384
2 changed files with 9 additions and 4 deletions

View File

@@ -22,6 +22,11 @@
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>
<queries>
<package android:name="com.health.openscale.sync.oss" />
<package android:name="com.health.openscale.sync" />
</queries>
<application
android:allowBackup="true"
android:requestLegacyExternalStorage="true"

View File

@@ -725,7 +725,7 @@ public class OpenScale {
private void syncInsertMeasurement(ScaleMeasurement scaleMeasurement, String pkgName) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(pkgName, pkgName + ".core.service.SyncService"));
intent.setComponent(new ComponentName(pkgName, "com.health.openscale.sync.core.service.SyncService"));
intent.putExtra("mode", "insert");
intent.putExtra("userId", scaleMeasurement.getUserId());
intent.putExtra("weight", scaleMeasurement.getWeight());
@@ -738,7 +738,7 @@ public class OpenScale {
private void syncUpdateMeasurement(ScaleMeasurement scaleMeasurement, String pkgName) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(pkgName, pkgName + ".core.service.SyncService"));
intent.setComponent(new ComponentName(pkgName, "com.health.openscale.sync.core.service.SyncService"));
intent.putExtra("mode", "update");
intent.putExtra("userId", scaleMeasurement.getUserId());
intent.putExtra("weight", scaleMeasurement.getWeight());
@@ -751,7 +751,7 @@ public class OpenScale {
private void syncDeleteMeasurement(Date date, String pkgName) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(pkgName, pkgName + ".core.service.SyncService"));
intent.setComponent(new ComponentName(pkgName, "com.health.openscale.sync.core.service.SyncService"));
intent.putExtra("mode", "delete");
intent.putExtra("date", date.getTime());
ContextCompat.startForegroundService(context, intent);
@@ -759,7 +759,7 @@ public class OpenScale {
private void syncClearMeasurements(String pkgName) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(pkgName, pkgName + ".core.service.SyncService"));
intent.setComponent(new ComponentName(pkgName, "com.health.openscale.sync.core.service.SyncService"));
intent.putExtra("mode", "clear");
ContextCompat.startForegroundService(context, intent);
}