Skip to content

This module for execute shell android, use command and execute shell

License

Notifications You must be signed in to change notification settings

M-Julius/react-native-android-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-android-shell

This module for execute shell android, use command and execute shell

Screenshot

Alt text Alt text Alt text

Getting started

$ npm install react-native-android-shell --save

Usage

import AndroidShell from 'react-native-android-shell';

// TODO: What to do with the module?
AndroidShell.executeCommand('your Command', (result) => {
  console.log(result)
});

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;

About

This module for execute shell android, use command and execute shell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published