Unable to establish connection on channel:
Description
I/flutter ( 4379): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 4379): │ #0 ProfileVm.enableBiometricLogin (package:ansuinvest/src/dashboard/vm/profile.vm.dart:37:14)
I/flutter ( 4379): │ #1
C:\Users\shiwa\StudioProjects\ansuinvest\android\app\src\main\kotlin\com\example\ansuinvest\MainActivity.kt
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity : FlutterFragmentActivity()
C:\Users\shiwa\StudioProjects\ansuinvest\android\app\src\main\AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="Ansu Invest">
<activity
android:name="com.ryanheise.audioservice.AudioServiceActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:enableOnBackInvokedCallback="true"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:networkSecurityConfig="@xml/network_security_config"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="flutter_deeplinking_enabled"
android:value="true" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="ansuinvest.com"
android:pathPrefix="/research-opinion/view"
android:scheme="https" />
<data
android:host="ansuinvest.com"
android:pathPrefix="/news"
android:scheme="https" />
</intent-filter>
</activity>
<service
android:name="com.ryanheise.audioservice.AudioService"
android:exported="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
<receiver
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
<!-- 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" />
<meta-data
android:name="io.flutter.embedding.android.Imperller"
android:value="false" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility 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>
</queries>
</manifest>
Calling this function on click
Future<void> enableBiometricLogin() async {
await Future.delayed(Duration(milliseconds: 100)); //
try {
bool canAuthenticate = await FlutterLocker.canAuthenticate();
if (canAuthenticate) {
// Save a secret to indicate biometric login is enabled
await FlutterLocker.save(
SaveSecretRequest(
key: _biometricKey,
secret: _biometricSecret,
androidPrompt: AndroidPrompt(
title: 'Authenticate',
cancelLabel: 'Cancel',
),
),
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Biometric login enabled')),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Biometric authentication not available')),
);
}
} catch (e) {
logger.e(e);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e')),
);
}
}
Additional information
As I am using just_audio_background package as per doc I changed name to android:name="com.ryanheise.audioservice.AudioServiceActivity" which is not extended by FlutterFragmentActivity() So How can I fix it???