You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Retrofit2 with OkHttp. Everything is working fine with it except the one thing - a network call when app is closed or in background.
Working
Whenever Firebase notification arrives, I make a network call to fetch data related to that notifications and then show notification.
Scenario
Consider an Android app which is in background or closed and notification arrives.
What's Happening
Notification arrives successfully, I can see it. But when I try to make a call, it is always giving an error Failed to connect to: ******* and I can't see any call coming on server.
I have seen some similar type of issues but none of them could help me.
Here's a list:
I am using Retrofit2 with OkHttp. Everything is working fine with it except the one thing - a network call when app is closed or in background.
Working
Whenever Firebase notification arrives, I make a network call to fetch data related to that notifications and then show notification.
Scenario
Consider an Android app which is in background or closed and notification arrives.
What's Happening
Notification arrives successfully, I can see it. But when I try to make a call, it is always giving an error Failed to connect to: ******* and I can't see any call coming on server.
I have seen some similar type of issues but none of them could help me.
Here's a list:
Some suggested to use connectionPool and some to use pingInterval. Nothing worked in my case. I am not sure if it's bug of Retrofit or OkHttp.
Below is the piece of code I am using for the call. Remember that it's working perfectly fine when app is in foreground.
It always returns
SocketTimeoutException
. Any help/guidance is appreciated.The text was updated successfully, but these errors were encountered: