目次

native module

react-nativeでAndroidのAPIを使う

react-nativeでAndroidのAPIを扱う(Native Modules編)
Native Modules

voximplant/react-native-foreground-service

1.ReactContextBaseJavaModuleを継承したクラスを作る

2.ReactPackageを継承したクラスを作る

3.MainApplicationに組み込み

4.JS側にラッパークラスを用意する

import {NativeModules} from 'react-native';
export default NativeModules.[1.のgetName];

5.JSから呼び出す

その他.Android側でログの出力

import android.util.Log;

Log.i("INFO", "processing service");