Search code examples
androidandroid-studio

do i have to use any foreground service type in manifest if it has no need?


I am working on scheduling app in which i am using foreground service , in below code i am using dataSync but there is no need of it on my project , i saw many developers are using at least 1 foreground service type thats why i have mentioned it , my question is if i removed it would it effect my app or it is ok

   Here is my code in manifest 
     <service android:name=".service.CountdownService"

        android:foregroundServiceType="dataSync"
        />

Solution

  • If your service is not using anything like camera, microphone and location then attribute foregroundServiceType has no usage.

    You can check this documentation.

    https://developer.android.com/guide/components/foreground-services#loc-camera