mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-13 20:24:14 +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:
@@ -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"
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user