How to start a javascript component from android java code? - android

I'm trying to start a js component from android (not the main index file). I implemented a native module to reach Android from js but I couldn't do it for android to js. I've been searching for weeks but I couldn't find a solution. Is there anyone who knows if it's possible? I'm not so good at Android or react native, maybe that's why I couldn't understand if there is a solution in the docs.

Related

How to export React Native as .aar (for android) and .framework (for IOS)?

im new for this journey but i had research about this, like for 3 days maybe or later, and found so many Blog but without any tutorial to achive this.
according to this reference , it seems he/she finally can achive this AAR and .framework, but i still not understand how to generate that from react native.
can somebody tell me , where should i found this tutorial to make it ? im a bit frustated because i cannot solve this.
maybe any reference , step by step using an existing React Native Project then finnaly generate AAR and .framework, it will very very very usefull for me.
i hope someone can help me to solve this :(
I think you can solve this by Electrode Native
With Electrode Native, you can work on cross-platform components written in JavaScript using React Native, that can then be added to any iOS or Android mobile application. It outputs .aar file for android & .framework for iOS.

React Native UI for native application?

I'm done coding some core functionalities of an Android app, these had to be implemented in standard native Java code. Broadly speaking, it launches a Service and reads from a local DB with a SQLiteOpenHelper, but this last component will be replaced in the future for Bluetooth communication.
Now, I'd like to implement the UI using React Native; what's my best bet to combine native code with a UI made with React Native?
I have seen some options out there, but if there's any React Native expert familiarised with this, his/her tips and guidance would be of great help!
If it is just a service which you call occasionally then you create a react-native app, define your helper as a native module and call it from react-native.
It takes some time (and frustration so be prepared) to get going but after the first native module it will be quite straight forward. Here is a guide to implement a native (java) module in android.
Launching an activity is different story.

Is it a good idea to reuse the native code generated from React Native to continue building a native application?

I have an application developed with ReactNative but now my client wants to get rid of it and go native in Android and iOS, I got the native code that RN generates for both but it is strongly tided to RN libraries, is it a good idea to continue like this and try to re-use the code or it's better to start over from zero with native code?
You could re-use some of your code, but I would advice against this. It'll be easier to rewrite the whole app (2 times) than to try to decouple your code from react native's library.
Although, couldn't you convince your client to stay with RN? The problem that RN fix is the need to write your app twice, if you go on this path you'll take twice the time to achieve the same result, and you'll encounter some problems hard to debug if you are not comfortable working with Android and iOS' custom frameworks.

Project structure of react-native application

I am starting working over react-native for development of android application. I am quite familiar with android studio structure. In android sdk to create view XML is present and for controller java is present. But in react-native how to create view and controller for android application ?
But in react-native how to create view and controller for android application ?
This question is like given an apple but analyze as an orange.
For react-native, exactly for React part, we don't explicitly manage it as view and controller as we did for android or ios.
I suggest you read about React first. It is the core idea. The Native part is just meaning build the native mobile app by React way (you have totally 100% ways to touch the native part - android/ios code - without any restriction as you want).

How to show git-describe in React Native app?

I generally like to automatically bake-in the results of a git describe --always --dirty in any website, app, etc I am developing so that I can easily trace behaviors. Right now, I can't figure out a way to get this in a React Native app.
I am using Android, but am certainly looking for a solution to both Android and iOS.
I found a way using a mix of other existing answers:
Call git-describe during the build to access from gradle
Call PackageManager to access the gradle config from Java
Then use a React NativeModule in Java to access from JS
Update (3 years later): Here's a minimal diff that shows how to implement in Android.

Categories

Resources