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
I am Building an app that needs to support Android Auto to play Device music. So what I do is to check permissions with Audio Query and retrieve a list of songs. Apparently when app is active and on Foreground, its able to show local songs correctly, but when user connects to Android Auto and App is in background, then its crashes the app on Android Auto and trying to Launch the app on the phone, leads to Plugin error as shown below:
final isStoragePermissionGranted = await _requestStoragePermission();
if (isStoragePermissionGranted) {
final audios = await _audioQuery.querySongs(
sortType: null,
orderType: OrderType.ASC_OR_SMALLER,
uriType: UriType.EXTERNAL,
ignoreCase: true,
);
Exception
E Failed to handle method call
kotlin.UninitializedPropertyAccessException: lateinit property context has not been initialized
at com.lucasjosino.on_audio_query.PluginProvider.context(PluginProvider.kt:63)
at com.lucasjosino.on_audio_query.controllers.PermissionController.permissionStatus(PermissionController.kt:41)
at com.lucasjosino.on_audio_query.OnAudioQueryPlugin.onMethodCall(OnAudioQueryPlugin.kt:79)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
The text was updated successfully, but these errors were encountered:
I am Building an app that needs to support Android Auto to play Device music. So what I do is to check permissions with Audio Query and retrieve a list of songs. Apparently when app is active and on Foreground, its able to show local songs correctly, but when user connects to Android Auto and App is in background, then its crashes the app on Android Auto and trying to Launch the app on the phone, leads to Plugin error as shown below:
Function to check and give permissions:
Retrieve songs:
Exception
The text was updated successfully, but these errors were encountered: