Hello Bruh, execute the shell is in my opinion very important, to find out detailed information on android.
Getting Started
$ npx react-native init nameYourProject
$ cd nameYourProject
$ npm install react-native-android-shell --save
Edit App.js file
replace code, using within code
Example
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import AndroidShell from 'react-native-android-shell'
class demo extends Component {
constructor(props) {
super(props);
this.state = {
result: ''
};
}
componentDidMount() {
AndroidShell.executeCommand("ls", (result) => {
this.setState({ result: 'yeu : ' + result });
console.log('Result :', result);
});
}
render() {
return (
<View style={{ alignItems: 'center', flex: 1 }}>
<Text>{this.state.result}</Text>
</View>
);
}
}
export default demo;
Top comments (3)
hello Julius thankx for your post.
i got this error when i try your exemple.
i think that executeCommand method not exist
can you help ?
thankx
how to use commands like "pkg install "
you need root, and install proot package for super user