Closed tomo689 closed 9 months ago
I have the same issue on API 34 and on physical device (Galaxy A33). Any suggestions?
Hi, I had the exact same issue as you on a physical Samsung Galaxy S21 (Android 14). I looked at the mainfest in the example app.
Turns out I was missing the activity-alias.
<activity-alias
android:name="ViewPermissionUsageActivity"
android:exported="true"
android:targetActivity=".MainActivity"
android:permission="android.permission.START_VIEW_PERMISSION_USAGE">
<intent-filter>
<action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
<category android:name="android.intent.category.HEALTH_PERMISSIONS" />
</intent-filter>
</activity-alias>
To be precise, you need to do the following:
<!-- Check whether Health Connect is installed or not -->
<queries>
<package android:name="com.google.android.apps.healthdata" />
<intent>
<action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent>
</queries>
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.health.READ_STEPS"/>
<!-- Intention to show Permissions screen for Health Connect API -->
<intent-filter>
<action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent-filter>
<activity-alias
android:name="ViewPermissionUsageActivity"
android:exported="true"
android:targetActivity=".MainActivity"
android:permission="android.permission.START_VIEW_PERMISSION_USAGE">
<intent-filter>
<action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
<category android:name="android.intent.category.HEALTH_PERMISSIONS" />
</intent-filter>
</activity-alias>
Hopefully this helps! I would recommend comparing your manifest with the example app's manifest and trying again.
Hi, I had the exact same issue as you on a physical Samsung Galaxy S21 (Android 14). I looked at the mainfest in the example app.
Turns out I was missing the activity-alias.
<activity-alias android:name="ViewPermissionUsageActivity" android:exported="true" android:targetActivity=".MainActivity" android:permission="android.permission.START_VIEW_PERMISSION_USAGE"> <intent-filter> <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" /> <category android:name="android.intent.category.HEALTH_PERMISSIONS" /> </intent-filter> </activity-alias>
To be precise, you need to do the following:
1. Change FlutterActivity to FlutterFragmentActivity in android/app/src/main/kotlin/<your_app_package>/MainActivity.kt 2. Add the query to check if health connect is installed or not in android/app/src/main/AndroidManifest.xml (outside of the application tag)
<!-- Check whether Health Connect is installed or not --> <queries> <package android:name="com.google.android.apps.healthdata" /> <intent> <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" /> </intent> </queries>
3. Add the permissions for the data types you use in the AndroidManifest.xml, activity recognition is always needed (outside of the application tag).
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/> <uses-permission android:name="android.permission.health.READ_STEPS"/>
5. Add the intent to show permissions (inside the application tag) in the AndroidManifest.xml.
<!-- Intention to show Permissions screen for Health Connect API --> <intent-filter> <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" /> </intent-filter>
6. Add the activity-alias (outside the application tag) in the AndroidManifest.xml.
<activity-alias android:name="ViewPermissionUsageActivity" android:exported="true" android:targetActivity=".MainActivity" android:permission="android.permission.START_VIEW_PERMISSION_USAGE"> <intent-filter> <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" /> <category android:name="android.intent.category.HEALTH_PERMISSIONS" /> </intent-filter> </activity-alias>
Hopefully this helps! I would recommend comparing your manifest with the example app's manifest and trying again.
I had the same issue, and this solution worked for me. Just a small clarification, though: the activity-alias should be copied inside the
Hi, I had the exact same issue as you on a physical Samsung Galaxy S21 (Android 14). I looked at the mainfest in the example app. Turns out I was missing the activity-alias.
<activity-alias android:name="ViewPermissionUsageActivity" android:exported="true" android:targetActivity=".MainActivity" android:permission="android.permission.START_VIEW_PERMISSION_USAGE"> <intent-filter> <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" /> <category android:name="android.intent.category.HEALTH_PERMISSIONS" /> </intent-filter> </activity-alias>
To be precise, you need to do the following:
1. Change FlutterActivity to FlutterFragmentActivity in android/app/src/main/kotlin/<your_app_package>/MainActivity.kt 2. Add the query to check if health connect is installed or not in android/app/src/main/AndroidManifest.xml (outside of the application tag)
<!-- Check whether Health Connect is installed or not --> <queries> <package android:name="com.google.android.apps.healthdata" /> <intent> <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" /> </intent> </queries>
3. Add the permissions for the data types you use in the AndroidManifest.xml, activity recognition is always needed (outside of the application tag).
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/> <uses-permission android:name="android.permission.health.READ_STEPS"/>
5. Add the intent to show permissions (inside the application tag) in the AndroidManifest.xml.
<!-- Intention to show Permissions screen for Health Connect API --> <intent-filter> <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" /> </intent-filter>
6. Add the activity-alias (outside the application tag) in the AndroidManifest.xml.
<activity-alias android:name="ViewPermissionUsageActivity" android:exported="true" android:targetActivity=".MainActivity" android:permission="android.permission.START_VIEW_PERMISSION_USAGE"> <intent-filter> <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" /> <category android:name="android.intent.category.HEALTH_PERMISSIONS" /> </intent-filter> </activity-alias>
Hopefully this helps! I would recommend comparing your manifest with the example app's manifest and trying again.
I had the same issue, and this solution worked for me. Just a small clarification, though: the activity-alias should be copied inside the tag, not outside
Thanks! Have updated the comment.
Device / Emulator and OS ・Pixel 7Pro API 34 ・Pixel 6a API 30
Describe the bug I got the below error on the Pixel 7Pro API 34 emulator. (I didn't have any problems on the Pixel 6a API 30 emulator.)
Error Content
pubspec.yaml
AndroidManifest.xml
I am sure that user permission is correctly set up in AndroidManifest.xml