Skip to content

Commit e4f2a79

Browse files
authored
Merge pull request #518 from carp-dk/cortrium-hr
Fix sensing app not building for Android
2 parents 76c23a5 + 1c2b919 commit e4f2a79

21 files changed

Lines changed: 170 additions & 118 deletions

File tree

apps/carp_mobile_sensing_app/android/app/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ android {
1212

1313
compileOptions {
1414
coreLibraryDesugaringEnabled = true
15-
sourceCompatibility = JavaVersion.VERSION_1_8
16-
targetCompatibility = JavaVersion.VERSION_1_8
15+
sourceCompatibility = JavaVersion.VERSION_17
16+
targetCompatibility = JavaVersion.VERSION_17
1717
}
1818

1919
kotlinOptions {
20-
jvmTarget = JavaVersion.VERSION_1_8
20+
jvmTarget = '17'
2121
}
2222

2323
defaultConfig {
@@ -44,6 +44,8 @@ dependencies {
4444
// Use to implement Health Connect. Requires SDK level 34.
4545
implementation "androidx.health.connect:connect-client:1.1.0-rc02"
4646
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
47+
// AppCompat library for Theme.AppCompat.NoActionBar
48+
implementation 'androidx.appcompat:appcompat:1.7.0'
4749
}
4850

4951
flutter {

apps/carp_mobile_sensing_app/android/app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
2828
<uses-permission android:name="android.permission.WAKE_LOCK" />
2929
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
30+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
3031
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
3132

3233
<!-- for Android 9 (API 28 and below), use: -->
@@ -194,5 +195,13 @@
194195
<meta-data
195196
android:name="flutterEmbedding"
196197
android:value="2" />
198+
199+
<!-- Location service with foreground service type for Android 14+ -->
200+
<service
201+
android:name="com.lyokone.location.FlutterLocationService"
202+
android:enabled="true"
203+
android:exported="false"
204+
android:foregroundServiceType="location"
205+
tools:replace="android:foregroundServiceType" />
197206
</application>
198207
</manifest>

apps/carp_mobile_sensing_app/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ plugins {
2323
// id "org.jetbrains.kotlin.android" version "2.0.0" apply false
2424

2525
id "com.android.application" version '8.10.1' apply false
26-
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
26+
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
2727
}
2828

2929
include ":app"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:

apps/carp_mobile_sensing_app/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>13.0</string>
2525
</dict>
2626
</plist>

apps/carp_mobile_sensing_app/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
1212
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13+
54AA01F4112BB55AF6F3FB8A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 85D4562AC19498C44634738E /* Pods_Runner.framework */; };
1314
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1415
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
15-
8579A77998212F36726877AC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D9096F33A852F3AF57CB3C1 /* Pods_Runner.framework */; };
1616
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1717
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1818
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@@ -43,17 +43,18 @@
4343
/* End PBXCopyFilesBuildPhase section */
4444

4545
/* Begin PBXFileReference section */
46-
1312C27C8258C4558AABBC37 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
4746
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4847
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
48+
19A80A4EBFB3316565C8DD86 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
4949
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
5050
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5151
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5252
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
5353
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
54-
7523FE4B8B18392943128232 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
54+
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = "<group>"; };
55+
79DE2EDEE9687F42D770FE5A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
5556
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
56-
7D9096F33A852F3AF57CB3C1 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
57+
85D4562AC19498C44634738E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5758
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
5859
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
5960
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -64,7 +65,7 @@
6465
ABAFDD0B2D9E8FCB00691BDF /* CoreAudioTypes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudioTypes.framework; path = System/Library/Frameworks/CoreAudioTypes.framework; sourceTree = SDKROOT; };
6566
ABAFDD0D2D9E90AF00691BDF /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
6667
ABAFDD152D9ECA9100691BDF /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
67-
D10B79D93537C018E18CFF62 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
68+
E1ACD7C2F1D200D126D40CD1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
6869
/* End PBXFileReference section */
6970

7071
/* Begin PBXFrameworksBuildPhase section */
@@ -74,7 +75,7 @@
7475
files = (
7576
ABAFDD0E2D9E90AF00691BDF /* CoreAudio.framework in Frameworks */,
7677
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
77-
8579A77998212F36726877AC /* Pods_Runner.framework in Frameworks */,
78+
54AA01F4112BB55AF6F3FB8A /* Pods_Runner.framework in Frameworks */,
7879
);
7980
runOnlyForDeploymentPostprocessing = 0;
8081
};
@@ -91,9 +92,9 @@
9192
09F22D635E2A50491278A6C9 /* Pods */ = {
9293
isa = PBXGroup;
9394
children = (
94-
7523FE4B8B18392943128232 /* Pods-Runner.debug.xcconfig */,
95-
D10B79D93537C018E18CFF62 /* Pods-Runner.release.xcconfig */,
96-
1312C27C8258C4558AABBC37 /* Pods-Runner.profile.xcconfig */,
95+
E1ACD7C2F1D200D126D40CD1 /* Pods-Runner.debug.xcconfig */,
96+
19A80A4EBFB3316565C8DD86 /* Pods-Runner.release.xcconfig */,
97+
79DE2EDEE9687F42D770FE5A /* Pods-Runner.profile.xcconfig */,
9798
);
9899
path = Pods;
99100
sourceTree = "<group>";
@@ -111,14 +112,15 @@
111112
children = (
112113
ABAFDD0D2D9E90AF00691BDF /* CoreAudio.framework */,
113114
ABAFDD0B2D9E8FCB00691BDF /* CoreAudioTypes.framework */,
114-
7D9096F33A852F3AF57CB3C1 /* Pods_Runner.framework */,
115+
85D4562AC19498C44634738E /* Pods_Runner.framework */,
115116
);
116117
name = Frameworks;
117118
sourceTree = "<group>";
118119
};
119120
9740EEB11CF90186004384FC /* Flutter */ = {
120121
isa = PBXGroup;
121122
children = (
123+
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
122124
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
123125
9740EEB21CF90195004384FC /* Debug.xcconfig */,
124126
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@@ -189,14 +191,14 @@
189191
isa = PBXNativeTarget;
190192
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
191193
buildPhases = (
192-
C36405A17497DF113203C7E0 /* [CP] Check Pods Manifest.lock */,
194+
1FB35733271CF8C777A99D41 /* [CP] Check Pods Manifest.lock */,
193195
9740EEB61CF901F6004384FC /* Run Script */,
194196
97C146EA1CF9000F007C117D /* Sources */,
195197
97C146EB1CF9000F007C117D /* Frameworks */,
196198
97C146EC1CF9000F007C117D /* Resources */,
197199
9705A1C41CF9048500538489 /* Embed Frameworks */,
198200
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
199-
97CF6E85DDE31A9E4E5CD206 /* [CP] Copy Pods Resources */,
201+
C08D0469E81CB0D1E7D56AC1 /* [CP] Copy Pods Resources */,
200202
);
201203
buildRules = (
202204
);
@@ -274,6 +276,28 @@
274276
/* End PBXResourcesBuildPhase section */
275277

276278
/* Begin PBXShellScriptBuildPhase section */
279+
1FB35733271CF8C777A99D41 /* [CP] Check Pods Manifest.lock */ = {
280+
isa = PBXShellScriptBuildPhase;
281+
buildActionMask = 2147483647;
282+
files = (
283+
);
284+
inputFileListPaths = (
285+
);
286+
inputPaths = (
287+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
288+
"${PODS_ROOT}/Manifest.lock",
289+
);
290+
name = "[CP] Check Pods Manifest.lock";
291+
outputFileListPaths = (
292+
);
293+
outputPaths = (
294+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
295+
);
296+
runOnlyForDeploymentPostprocessing = 0;
297+
shellPath = /bin/sh;
298+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
299+
showEnvVarsInLog = 0;
300+
};
277301
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
278302
isa = PBXShellScriptBuildPhase;
279303
alwaysOutOfDate = 1;
@@ -305,7 +329,7 @@
305329
shellPath = /bin/sh;
306330
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
307331
};
308-
97CF6E85DDE31A9E4E5CD206 /* [CP] Copy Pods Resources */ = {
332+
C08D0469E81CB0D1E7D56AC1 /* [CP] Copy Pods Resources */ = {
309333
isa = PBXShellScriptBuildPhase;
310334
buildActionMask = 2147483647;
311335
files = (
@@ -322,28 +346,6 @@
322346
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
323347
showEnvVarsInLog = 0;
324348
};
325-
C36405A17497DF113203C7E0 /* [CP] Check Pods Manifest.lock */ = {
326-
isa = PBXShellScriptBuildPhase;
327-
buildActionMask = 2147483647;
328-
files = (
329-
);
330-
inputFileListPaths = (
331-
);
332-
inputPaths = (
333-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
334-
"${PODS_ROOT}/Manifest.lock",
335-
);
336-
name = "[CP] Check Pods Manifest.lock";
337-
outputFileListPaths = (
338-
);
339-
outputPaths = (
340-
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
341-
);
342-
runOnlyForDeploymentPostprocessing = 0;
343-
shellPath = /bin/sh;
344-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
345-
showEnvVarsInLog = 0;
346-
};
347349
/* End PBXShellScriptBuildPhase section */
348350

349351
/* Begin PBXSourcesBuildPhase section */
@@ -439,7 +441,7 @@
439441
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
440442
GCC_WARN_UNUSED_FUNCTION = YES;
441443
GCC_WARN_UNUSED_VARIABLE = YES;
442-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
444+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
443445
MTL_ENABLE_DEBUG_INFO = NO;
444446
SDKROOT = iphoneos;
445447
SUPPORTED_PLATFORMS = iphoneos;
@@ -580,7 +582,7 @@
580582
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
581583
GCC_WARN_UNUSED_FUNCTION = YES;
582584
GCC_WARN_UNUSED_VARIABLE = YES;
583-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
585+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
584586
MTL_ENABLE_DEBUG_INFO = YES;
585587
ONLY_ACTIVE_ARCH = YES;
586588
SDKROOT = iphoneos;
@@ -633,7 +635,7 @@
633635
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
634636
GCC_WARN_UNUSED_FUNCTION = YES;
635637
GCC_WARN_UNUSED_VARIABLE = YES;
636-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
638+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
637639
MTL_ENABLE_DEBUG_INFO = NO;
638640
SDKROOT = iphoneos;
639641
SUPPORTED_PLATFORMS = iphoneos;

apps/carp_mobile_sensing_app/lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ import 'package:carp_movisens_package/carp_movisens_package.dart';
2020
import 'package:carp_health_package/health_package.dart';
2121
import 'package:health/health.dart';
2222
// import 'package:carp_movesense_package/carp_movesense_package.dart';
23-
import 'package:carp_cortrium_package/carp_cortrium_package.dart';
23+
// import 'package:carp_cortrium_package/carp_cortrium_package.dart';
2424

2525
import 'package:carp_webservices/carp_auth/carp_auth.dart';
2626
import 'package:carp_webservices/carp_services/carp_services.dart';
2727
import 'package:carp_backend/carp_backend.dart';
28+
import 'package:package_info_plus/package_info_plus.dart';
2829

2930
import 'config.dart';
3031

apps/carp_mobile_sensing_app/lib/src/app.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ class LoadingPage extends StatelessWidget {
2020
///
2121
/// Returns true when successfully done.
2222
Future<bool> init(BuildContext context) async {
23-
// Try to get location permissions as the first thing.
23+
// Request all necessary permissions upfront
2424
await Permission.locationWhenInUse.request();
25+
await Permission.locationAlways.request();
26+
await Permission.activityRecognition.request();
27+
await Permission.sensors.request();
28+
29+
// For Android 14+, also request notification permission for foreground services
30+
if (Theme.of(context).platform == TargetPlatform.android) {
31+
await Permission.notification.request();
32+
}
2533

2634
// Initialize and use the CAWS backend if not in local deployment mode
2735
if (bloc.deploymentMode != DeploymentMode.local) {

0 commit comments

Comments
 (0)