1.0.8 • Published 3 years ago

rn-foreground-service v1.0.8

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago
Installation:

npm i rn-foreground-service

Usage:
  <Button title="start service" color={'green'} onPress={()=>{RNForegroundService.toggle(1).then(res=>log(res))}}/>
  <Button title="Stop service" color={'red'} onPress={()=>{RNForegroundService.toggle(0).then(res=>log(res))}}/>
  // if you stopped the service and restarted the device then it won't start the service automatically.
  // I will add this functionality in next update. For now I am not using the services in my app anymore.

You Might need to make some changes in AndroidManifest.xml

<application>
    ...
    <service
        android:name=".ObserverService"
        android:enabled="true"
        android:exported="true" >
    </service>
    <receiver android:name=".StartupReceiver" android:enabled="true" android:exported="false">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
        </intent-filter>
    </receiver>
    ...
</application>

Also add permissions

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago