this is a react-native library for launching the application when the application is closed . usually we can use this in headless js . (like fcm background messaging and etc)
$ npm install react-native-launch-application --save
$ react-native link react-native-launch-application
Not Available
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.reactlibrary.SajjadLaunchApplicationPackage;
to the imports at the top of the file - Add
new SajjadLaunchApplicationPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-launch-application' project(':react-native-launch-application').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-launch-application/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-launch-application')
You can use this library in headless js for example launching the application when a notification received even if your app swiped out . even if your screen locked.
import SajjadLaunchApplication from 'react-native-launch-application';
import type {RemoteMessage} from 'react-native-firebase';
//PackageName Must Be String For example "com.domain.application"
export default async (message: RemoteMessage) => {
SajjadLaunchApplication.open(PackageName);
}