'Is it possible to call a @ReactMethod from the native code itself? or call a method in the native module
This might be a silly question but I am new to android/kotlin and react native. I want to know if it is possible to call a @ReactMethod from the kotlin code itself same as you do in the javascript by importing NativeModules from react-native
My actual problem is trying to call a method in the native module from the activity when a new intent happens (usb device plugged in), if theres a way to do that I would like to know.
Again, I'm a beginner in this area sorry
Solution 1:[1]
I found an answer to my silly question so I'll try to make life easier for the next one if there ever is one.
Instead of calling the native module from the activity, simply make the native module listen to the intent itself by making its class extend "ActivityEventListener", and don't forget to implement the methods "onActivityResult" and "onNewIntent" to make the error go away Good luck !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | adame21 |
