How to create Android bluetooth native module in react-native or Is there any plugin readily available
<p>I am new to react-native. I am working on application which connects to a bluetooth device and gets data from it. As React native allows to create native modules and use them in React JS, I am trying to create a native bluetooth module.
Could any one help me out.</p>

<pre><code>/**
* Created by ravitheja.bandari on 4/4/2016.
 */
public class BluetoothRN extends ReactContextBaseJavaModule implements ActivityEventListener {


// note that webView.isPaused() is not Xwalk compatible, so tracking it     poor-man style
private boolean isPaused;
private BluetoothAdapter bluetoothAdapter;
private Set&lt;BluetoothDevice&gt; pairedDevices;
private Promise bluetoothPromise;

private static final int BLUETOOTH_ENABLE_REQUEST = 1;
private static final String E_ACTIVITY_DOES_NOT_EXIST = "E_ACTIVITY_DOES_NOT_EXIST";
private static final String E_FAILED_TO_ENABLE_BLUETOOTH = "E_FAILED_TO_ENABLE_BLUETOOTH";


public BluetoothRN(ReactApplicationContext reactContext) {
super(reactContext);
}

@Override
public String getName() {
return "BluetoothAndroid";
}



@ReactMethod
public void getAdapter(){
bluetoothAdapter =   BluetoothAdapter.getDefaultAdapter();
}

@ReactMethod
public void getBondedDevices(final Promise promise){

Activity currentActivity = getCurrentActivity();

if (currentActivity == null) {
    promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist");
    return;
}

// Store the promise to resolve/reject when picker returns data
bluetoothPromise = promise;

try {
    Intent turnOn = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);

    currentActivity.startActivityForResult(turnOn, BLUETOOTH_ENABLE_REQUEST);
} catch (Exception e) {
    bluetoothPromise.reject(E_FAILED_TO_ENABLE_BLUETOOTH, e);
    bluetoothPromise = null;
}


}



private ArrayList getPairedDevices(){
pairedDevices = bluetoothAdapter.getBondedDevices();
ArrayList list = new ArrayList();

for(BluetoothDevice bt : pairedDevices)
    list.add(bt.getName());

return list;
}

@Nullable
@Override
public Map&lt;String, Object&gt; getConstants() {
final Map&lt;String, Object&gt; constants = new HashMap&lt;&gt;();

return constants;
}


@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {

}
}
</code></pre>

<p>ReactPackage</p>

<pre><code>public class BluetoothReactPackage implements ReactPackage {
@Override
public List&lt;NativeModule&gt; createNativeModules(ReactApplicationContext reactContext) {

List&lt;NativeModule&gt; modules = new ArrayList&lt;&gt;();

modules.add(new BluetoothRN(reactContext));


return modules;
}

@Override
public List&lt;Class&lt;? extends JavaScriptModule&gt;&gt; createJSModules() {
return null;
}

@Override
public List&lt;ViewManager&gt; createViewManagers(ReactApplicationContext reactContext) {
return null;
}
}
</code></pre>