Android Application class called periodically every day same hour causing network request overload

326 views Asked by At

In my app, in the Application class there is a function that triggers some network requests that fetch the needed data for the app to work. Recently i have noticed that these requests are trigger periodical every day at 11:00 GMT. From the logs i am getting it looks like it is not happening for every device using the app as the device ids i log every day are different. It looks like there is a library (there is nowhere in my code any periodical code that would trigger at that specific time per day causing it) that is causing it. In my app i use libs like Appsflyer, Google Play Services, Firebase, Crashlytics that could be triggering a sync job every day causing the issue though it is not possible to disable any of them in the production app. Unfortunately i am not able to repro the above problem on any of my devices so there is no way for me to debug it so far. Does any one has faced something similar or can give me any advice on how to move forward with this as these spike requests are causing issues and overload to our servers. Thanks in advance

1

There are 1 answers

0
Maxim Shoustin On

It can be silent push notifications for uninstall measurement (AppsFlyer).

The Android Uninstall 'Silent' push notification is not always silent for the clients. This is a common issue and it can be a major pain for the clients.

Why does it happen?

The client can be overriding firebase's onMessageReceived(RemoteMessage remoteMessage) method.Then they may have some of their own logic inside that method the is causing the push notification not to be silent.

Solution

The server side sends a 'silent' push with the payload {"af-uinstall-tracking":true}. The client will need to add a extra few lines of code to handle this specific payload.

For example:

@Override    
public void onMessageReceived(RemoteMessage remoteMessage) {
   if(remoteMessage.getData().containsKey("af-uinstall-tracking")){
              return;  
    } else { 
        // handleNotification(remoteMessage);     
 } 
}

Be sure it is not your case