website
website copied to clipboard
Update Android Intent handling on 'Flutter for Android developers' page
Hello!
I have simple communication case where android application is launching flutter application with intent containing some extra string data (using putExtra() method). Found official docs with guide how to handle such situations but unfortunetaly provided code from docs do not work as it uses io.flutter.app.FlutterActivity package.
Using io.flutter.embedding.android.FlutterActivity results in problem with GeneratedPluginRegistrant.registerWith(this); line, as .registerWith() expects to have FlutterEngine param, not MainActivity one.
Using suggested code for io.flutter.embedding.android.FlutterActivity :
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
results in problem with MethodChannel seen below (do I still need to call some registration method in onCreate() )?
MissingPluginException(No implementation found for method getSharedText on channel app.channel.shared.data)
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
Can someone provide me with usable solution on how to handle Intents in Flutter (v1.12.13+hotfix.9)? It will be good to update docs too, now it is more confusing than helpful.
Thanks in advance!