Firebase Database Does Not Block Online Data Blocking Listeners

I use the Firebase database service to synchronize user data. I turned on autonomous compatibility, and the problem is that after a few months the use of user data is not transferred to the online database, apparently due to the fact that user phone systems block the application’s Internet connection.

In some cases, I was able to configure users to use the "unlimited data usage" option, but it does not work for everyone.

In my case, the problem is that the listener:

void onDataChange(DataSnapshot var1);

of ValueEventListener, does not start when a huge amount of data is stored offline and is not fixed, and blocks all actions.

I have no restrictions for storing on the Internet, because I have a plan Blaze(payment for consumption).

Transactions are also not completed, and the "transaction was overridden by subsequent dialing" error code -9 is triggered.

The connection detector provided by Firebase always prints "not connected"

I also tried changing goOffline()to goOnline(), but nothing happens.

I don’t understand why the phone can block my application from synchronization and allow applications like Facebook and Youtube to consume a lot of Internet data.

This behavior only occurs on Android devices; there are no problems on iOS phones that use the same Firebase database.

It does not work with 4g, nor with WI-FI, nor with VPN (Opera VPN is used).

Update 1:

~ 10 :

11-13 21:12:28.477 15765 15856 D PersistentConnection: pc_0 - Scheduling connection attempt
11-13 21:12:28.477 15765 15856 D ConnectionRetryHelper: Scheduling retry in 26091ms
11-13 21:12:54.597 15765 15856 D PersistentConnection: pc_0 - Trying to fetch auth token
11-13 21:12:55.747 15765 15856 D PersistentConnection: pc_0 - Error fetching token: An internal error has occurred. [ 
TOKEN_EXPIRED ]

:

RepoOperation: Aborting transactions for path: [the path]
+6
1

, .

, , FirebaseAuth.AuthStateListener

,

1) , :

    public static boolean isOnline(Context context)
    {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

        return networkInfo != null && networkInfo.isConnectedOrConnecting();
    }

2) , :

, :

try
{
    user.getIdToken(true).addOnCompleteListener(new OnCompleteListener<GetTokenResult>()
    {
        @Override
        public void onComplete(@NonNull Task<GetTokenResult> task)
        {
            if (task.isSuccessful())
            {
                //succcess
            } else
            {
                //need login again
            }
        }
    });
}catch(Exception e)
{
    //need login again
}

, . , , , sdk.

, , , sdk.

+4

All Articles