Closed Samuel310 closed 10 months ago
Interesting. We haven't tried running it in a service. Is there a use case for doing that? For lots of reasons we would recommend running this as part of your main application.
It sounds a bit like this report also: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1316
I have initialised recaptcha client inside the flutter application, its not inside the service. You can see the code i mentioned above. Steps:
I'm not sure what's the cause of this error but if i don't initialise the recaptcha client the app wont crash. And I checked the bug report which you mentioned, i'm not using flutter_inappwebview plugin in my flutter app. The only plugin i'm using in my app is recaptcha-enterprise-flutter as of now.
Got it. I have an idea what the problem may be, but it is likely an issue in the underlying sdk. We will look into it.
Internal bug reference: b/289537266
@Samuel310 Would it be possible to get a full example of the failure? I want to see how you are using MyForegroundServiceHelper etc. Thanks!
obsolete
Hello, I hope this message finds you well. I wanted to reach out to you regarding an issue I’ve encountered while using the recaptcha-enterprise-flutter package in conjunction with a foreground service in my Flutter app.
Issue Description: Foreground service is crashed when app is killed after initialising the RecaptchaEnterprise client by calling
await RecaptchaEnterprise.initClient(siteKey);
. But the foreground service is not crashed and worked as expected whenawait RecaptchaEnterprise.initClient(siteKey);
is commented out.Steps to Reproduce:
Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git Framework • revision eb6d86ee27 (9 months ago) • 2022-10-04 22:31:45 -0700 Engine • revision c08d7d5efc Tools • Dart 2.18.2 • DevTools 2.15.0
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.dark().copyWith( scaffoldBackgroundColor: Colors.white, ), debugShowCheckedModeBanner: false, home: const HomeScreen(), ); } }
class HomeScreen extends StatefulWidget { const HomeScreen({super.key});
@override State createState() => _HomeScreenState();
}
class _HomeScreenState extends State {
void _initializeRecaptchaClient({required String siteKey}) async { try { bool res = await RecaptchaEnterprise.initClient(siteKey); log("res : $res"); } catch (err) { log('Caught exception on initializeRecaptchaClient: $err'); } }
@override void initState() { super.initState(); _initializeRecaptchaClient(siteKey: "");
}
@override void dispose() { super.dispose(); }
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("SERVICES"), ), body: Column( children: [ ElevatedButton( onPressed: () async { // Wrote a separate plugin to handle foreground services in java. MyForegroundServiceHelper.instance.startService(); }, child: const Text("Start SOS"), ), ], ), ); } }
D/MyForegroundServicePlugin( 7124): onDetachedFromActivity: called D/MyForegroundServicePlugin( 7124): onDetachedFromEngine: *** Called W/cr_ChildProcessConn( 7124): onServiceDisconnected (crash or killed by oom): pid=7282 bindings:W S E/chromium( 7124): [ERROR:aw_browser_terminator.cc(156)] Renderer process (7282) crash detected (code -1). E/chromium( 7124): [ERROR:aw_browser_terminator.cc(112)] Render process (7282) kill (OOM or update) wasn't handed by all associated webviews, killing application. Lost connection to device.