react-native-autostarter
This is a wrapper of Autostarter
Getting started
$ npm install react-native-autostarter --save
or
$ yarn add react-native-autostarter
Mostly automatic installation
$ react-native link react-native-autostarter
Usage
Basic usage
; // check if the device model is available on the autostart permissionsAutostarter;
Or, you can display a fallback screen or overlay if auto-start permission is not available.
import React useCallback useEffect useState from "react";import Button FlatList Text View from "react-native";import Autostarter from "react-native-autostarter"; const AutoStarterOverlay = const onPress = ; return <View> <Text> To receive push notification please remove it from battery optimization </Text> <Button =>Enable</Button> </View> ;; const MyApp = const autoStartPermission setAutoStartPermission = ; ; return <View> autoStartPermission ? <AutoStarterOverlay /> : null <Text>Lorem Ipsum</Text> </View> ;;
Running the example
cd example
yarn
react-native run-android
License
react-native-autostarter
is MIT licensed, as found in the LICENSE file.