0

I am trying to implement this Appsflyer Uninstall Tracking feature: https://support.appsflyer.com/hc/en-us/articles/210289286?input_string=android+uninstall+tracking#Android-Uninstall

and it requires setting up a FCM service to handle silent push apparently. Problem is background services are restricted after API level 26: https://developer.android.com/guide/components/services

So how would this work? Am I missing something here? Tried searching for FCM and service background restrictions and found no discussions around that.

2 Answers2

1

I assume you are asking about the com.appsflyer.FirebaseMessagingServiceListener service? If so - this service is only used to obtain the Firebase token from Firebase - This happens on the first time you run the application and whenever Firebase decides to renew their token (also can only happen when the application is running, never in bg).

For AppsFlyer Uninstall Measurement receiving this token and being able to use it in the future is sufficient. there is no need for the application to be in foreground or even "alive" after the initial token registration, as there is no processing of any data by the AppsFlyer SDK for this cause.

0

In general the FCM documentation states that processing messages (and tokens) can be done within the service, as long as it's fast enough (20 secs.), see here: https://firebase.google.com/docs/cloud-messaging/android/receive

I guess if you're using the Appsflyer FirebaseMessagingServiceListener they will (at least they should when providing such service) handle all the background processing if necessary. Otherwise if you're intending to implement the FirebaseMessagingService by yourself, just hand over the FCM token as described in their documentation. Same should apply here: AppsFlyer should handle background processing if necessary.

For your own background processing (more then 20 secs.) consider using JobScheduler.

Tidder
  • 1,126
  • 1
  • 7
  • 15