rn-foreground-service

1.0.8 • Public • Published
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.

I have made this module for my own use. I would suggest you to use any aternative. If you still want to use it and having issues or want any new funtionality then simply create an issue on this repo. I will try to solve your issue.

I have not configured the notification. It will show a solid blue color as icon and no actions are added. I would make it usable for public use if I get know that public wants to use this module I will start work on it.

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" />

Readme

Keywords

Package Sidebar

Install

npm i rn-foreground-service

Weekly Downloads

1

Version

1.0.8

License

none

Unpacked Size

451 kB

Total Files

43

Last publish

Collaborators

  • kishorjena