Android - Invoke activity using reflection in android - android-activity

Is there any way to invoke an activity using reflection. I have an activity in my library project(.jar/dex), it is possible to launch the library project activity from my parent application.

Related

How to do keypress like Java Robot in Flutter Desktop?

I am stuck with my flutter desktop application development. I'm looking for features like Java Robot for send keypress from my Flutter desktop application. Unfortunately, I did not find any Flutter desktop plugin or core functionality in Flutter.
Robot r = new Robot();
r.keyPress(KeyEvent.VK_E);
r.keyRelease(KeyEvent.VK_E);
Flutter does not have any APIs for posting synthetic events to the OS. You would need to write native code (either as a plugin, or directly in the native part of your application) for each platform to do that.

FlutterPlugin vs FlutterActivity

for my Flutter App I want to write myself a small plugin which is using the camera natively in Android.
I was going through the documentation, and I got a basic understanding of the "glue" between Flutter and Native with MethodChannels. There is one thing I don't understand though:
What exactly is the difference, if my native class of the plugin is implementing a FlutterPlugin and ActivityAware, or if I use An Activity directly which is extending FlutterActivity and also connecting to the Flutter engine?

How can I call headless Dart code in a Flutter app from native platform

I'm using quick_actions plugin in one of my Flutter apps and wish to invoke a headless Dart function when user clicks on a shortcut.
I just wish to execute the dart code in background without showing the app screen to the user. I know many plugins like background_fetch, WorkManager etc can schedule to run dart code in background.
I'm assuming that the java code in quick_actions plugin might have to be modified to achieve?

Flutter add-to-app, Can we add multiple Flutter module into native project?

I have a question with Flutter's add-to-app current limitation here.
Refer to this doc. https://flutter.dev/docs/development/add-to-app
As of Flutter v1.12, add-to-app is supported for the basic scenario of integrating one full-screen Flutter instance at a time per app. It currently has the following limitations:
- Running multiple Flutter instances or running in partial screen views may have undefined behavior.
- Using Flutter in background mode is still a WIP.
- Packing multiple Flutter libraries into an application isn’t supported.
- Plugins used in add-to-app on Android should migrate to the [new Android plugin APIs][], based on FlutterPlugin.
Plugins that don’t support FlutterPlugin may have unexpected behaviors if they make assumptions that are untenable in add-to-app (such as assuming that a Flutter Activity is always present).
- As of v1.17, the Flutter module only supports AndroidX applications on
For this statement
Packing multiple Flutter libraries into an application isn’t supported.
Am I understand correctly that we can only create and add 1 Flutter module project into our android or ios project?
If yes then is there any workaround to do that?
You can separate your module by implement sub-module inside your main Flutter module, each sub-module will be controlled by a Flutter engine, meaning you'll have multiple Flutter engines, so state in each module will be kept and separated with the others.
You can refer my demo here https://github.com/duytq94/demo-integrate-flutter, partial screen & full screen is separated from each other.

Flutter - Android Native Platform Integration

When an external component such as a Camera or File picker is needed, the Flutter for Android Developers documentation (currently in the works) states that we would have to build a native platform integration.
I currently have a device that has a built-in barcode reader with a manufacturer-provided Android API. So, for that I would need to pursue this native platform integration method - or even for playing videos or using the camera for that matter I would think.
Is there an example repo that demonstrates how a well-integrated app should be? ..a project that integrated ExoPlayer for example?
You can use platform channels to call native APIs that aren't exposed by the Flutter platform.
There is an example in the Writing custom platform-specific code docs:
The full, runnable source-code for this example is available in /examples/platform_channel/ for Android with Java and iOS with Objective-C.
If you want to make your code reusable by others, you can publish it as a package, but this is optional. There is a repo of plugins maintained by the Flutter team that you can use for inspiration.