i keep getting Permission launcher not found when trying to request android health connect permission
Device / Emulator and OS
i'm emulating on a physical device
- Device: Nokia Nokia 2.3
- OS: (Android 11)
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
made the initial setup following the instruction from the read me.
i have a button that calls this function
`Future authorize() async {
final permissions = [
Permission.activityRecognition,
Permission.location,
];
await permissions.request();
bool? hasPermissions =
await Health().hasPermissions(health_settings.types, permissions: health_settings.permissions);
developer.log('has permission: $hasPermissions');
bool authorized = hasPermissions ?? false;
if (hasPermissions != true) {
try {
authorized = await Health()
.requestAuthorization(health_settings.types, permissions: health_settings.permissions);
} catch (error) {
developer.log("Exception in authorize: $error");
}
}
developer.log('is it authorized: $authorized');
// Update the global permission state
Provider.of<DevicePermissionProvider>(context, listen: false).setAuthorization(authorized);
setState(() => _state =
(authorized) ? AppState.AUTHORIZED : AppState.AUTH_NOT_GRANTED);
}`
The "Health().requestAuthorization" call returns false,
but then the Health().requestAuthorization keeps giving me this log👉 Permission launcher not found
therefore the permission popup never shows up
in case you're wondering where the health_permission.type is coming from. it's from this file
`
import 'package:health/health.dart';
var types = [
HealthDataType.STEPS,
HealthDataType.HEART_RATE,
HealthDataType.BODY_TEMPERATURE,
HealthDataType.WEIGHT,
HealthDataType.BLOOD_OXYGEN
];
List get permissions =>
types.map((e) => HealthDataAccess.READ).toList();
`
Expected behavior
show permission launcher
Actual behavior
doesn't show permission launcher
Screenshots
If applicable, add screenshots to help explain your problem.
Flutter doctor
Please run flutter doctor and add the output here.
Additional information
my manifest file
`
<!-- Intention to show Permissions screen for Health Connect API -->
<intent-filter>
<action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<!-- Create an activity alias to show the rationale
of Health Connect permissions once users click the privacy policy link. -->
<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>
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
<!-- Check whether Health Connect is installed or not -->
<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.INTERNET" />
<uses-permission android:name="android.permission.health.READ_HEART_RATE"/>
<uses-permission android:name="android.permission.health.READ_STEPS"/>
<uses-permission android:name="android.permission.health.READ_BODY_TEMPERATURE"/>
<uses-permission android:name="android.permission.health.READ_WEIGHT"/>
<uses-permission android:name="android.permission.health.READ_SLEEP"/>
<uses-permission android:name="android.permission.health.READ_OXYGEN_SATURATION"/>
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
`

i keep getting Permission launcher not found when trying to request android health connect permission
Device / Emulator and OS
i'm emulating on a physical device
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
made the initial setup following the instruction from the read me.
i have a button that calls this function
`Future authorize() async {
final permissions = [
Permission.activityRecognition,
Permission.location,
];
}`
The "Health().requestAuthorization" call returns false,
but then the Health().requestAuthorization keeps giving me this log👉 Permission launcher not found
therefore the permission popup never shows up
in case you're wondering where the health_permission.type is coming from. it's from this file
`
import 'package:health/health.dart';
var types = [
HealthDataType.STEPS,
HealthDataType.HEART_RATE,
HealthDataType.BODY_TEMPERATURE,
HealthDataType.WEIGHT,
HealthDataType.BLOOD_OXYGEN
];
List get permissions =>
types.map((e) => HealthDataAccess.READ).toList();
`
Expected behavior
show permission launcher
Actual behavior
doesn't show permission launcher
Screenshots
If applicable, add screenshots to help explain your problem.
Flutter doctor
Please run
flutter doctorand add the output here.Additional information
my manifest file
`