You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean {
try {
if (alreadyCalled || requestCode != PermissionHandler.PERMISSION_CODE_IGNORE_BATTERY_OPTIMIZATIONS) {
return false
}
alreadyCalled = true
// THIS IS ALWAYS FALSE
onSuccess(resultCode == Activity.RESULT_OK)
} catch (ex: Exception) {
onError("flutter_background.PermissionHandler", "Error while waiting for user to disable battery optimizations", ex.localizedMessage)
}
return true
}
resultCode always contains 0 no matter what the answer.
Even ignoring the return value of initialize in Flutter would not work, since the plugin does not continue to initialize itself.
To Reproduce
On the first run with following code:
await FlutterBackground.initialize(androidConfig: androidConfig);
if (await FlutterBackground.hasPermissions) {
await FlutterBackground.enableBackgroundExecution();
}
Confirm the allow permission request.
The application throws an exception and the background execution is not enabled.
The second walk through works, since the permission is then already granted.
Expected behavior
Since the same code works on Android 11 I guess the solution is to find a way to get a proper result code from the permission request. I don't know how to achieve this.
As an alternative for me also works to ignore the result code and always return true.
Smartphone:
Observed with:
Device: Motorola neo 30
OS: Android 12
Seems to work properly on
Device: ACEPAD A145
OS: Android 11
Thanks for your nice plugin.
The text was updated successfully, but these errors were encountered:
Thanks for creating the issue. Can you please upgrade to the new version of the plugin (1.3.0), update your AndroidManifest.xml according to the new README (specifically including the foreground service types) and report back?
Describe the bug
The result of
is always false, since
resultCode
always contains0
no matter what the answer.Even ignoring the return value of
initialize
in Flutter would not work, since the plugin does not continue to initialize itself.To Reproduce
On the first run with following code:
Confirm the allow permission request.
The application throws an exception and the background execution is not enabled.
The second walk through works, since the permission is then already granted.
Expected behavior
Since the same code works on Android 11 I guess the solution is to find a way to get a proper result code from the permission request. I don't know how to achieve this.
As an alternative for me also works to ignore the result code and always return true.
Smartphone:
Observed with:
Seems to work properly on
Thanks for your nice plugin.
The text was updated successfully, but these errors were encountered: