ivnsch / rust_android_ios

Android / iOS app with shared Rust logic
241 stars 21 forks source link

Access all Android SDK classes in Rust Library #10

Open jitender-kumar-dev opened 1 year ago

jitender-kumar-dev commented 1 year ago

I am working on an Android app (Flutter) in which all the UI is handled by Flutter, and all the backend/logical part needs to be handled by the Rust layer. I want to access all the Android SDK classes inside the Rust library e.g UsbManager, UsbDevice, BroadcastReceiver, Intent classes and other classes/services provided by the Android SDK.

Here is a use case - In order to achieve the USB_DEVICE_ATTACHED event, we have to register it using the BroadcastReceiver, and once the event occurs, we can get the call in onReceive() of our class, which is a subclass of BroadcastReceiver. Since BroadcastReceiver is an Android Component, how can i have this receiver in Rust library?

Thanks in advance...