react-native-callintent
v1.0.4
Published
A React Native Call intent for Android.
Downloads
20
Maintainers
Readme
react-native-callintent
A React Native call intent for Android.
Installation
npm install --save react-native-callintent
Add it to your android project
- In
android/setting.gradle
...
include ':RNCallIntent', ':app'
project(':RNCallIntent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-callintent')
- In
android/app/build.gradle
...
dependencies {
...
compile project(':RNCallIntent')
}
- In app/src/main/AndroidManifest.xml add permission to use call
<uses-permission android:name="android.permission.CALL_PHONE" />
- register module (in MainActivity.java)
import com.syarul.callintent.RNCallIntentPackage; // <--- import
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
......
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new RNCallIntentPackage()) // <------ add here
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "ExampleRN", null);
setContentView(mReactRootView);
}
......
}
Example
var CallIntent = require('react-native-callintent');
CallIntent.open('+60123049995');
License
MIT