Do I really need to export the SyncAdapter service?

onPerformSync(...) {
    // building status bar notification here
}

<service android:name=".SyncService" android:exported="false"> ...

      

This works for me (4.4.2 SGN3). Notifications appear. And requestSync()

, and addPeriodicSync()

.

Anyone have any thoughts?

Do I need to export the service SyncAdapter

?

What I really want to know is if any other (enemy) application can start my service exported

or not. If they can, I don't have to export the service, hoping Android won't be as liberal.

I didn't find any clarification in the Android dev / api manual. I am quite a beginner and I hope my question is correct and clear :)

+3


source to share


1 answer


Let's say you need to export the SyncService to use it from other applications. Here's what the documentation says:

The android: exported = "true" attribute allows processes other than your application (including the system) to access the Service.



If you don't need to share your sync with other apps, you can probably leave it unexported. But you need to test it on older versions of Android, the logic may change.

+1


source







All Articles