PokeGOAPI-Java
PokeGOAPI-Java copied to clipboard
`FATAL EXCEPTION: main` when Internet connection drops
Description:
Sometime my cellular network drops if there is bad coverage and if in that moment go.setLocation(lat, lon, alt); is called app will crash.
What is the easiest way to check if connection to Niantic servers still exists (user is still logged)?
Steps to reproduce:
- Connect to PTC
go.setLocation(lat, lon, alt);- Disable Internet
go.setLocation(lat, lon, alt);and app will crash
Stacktrace (If it's a crash):
beginning of crash
FATAL EXCEPTION: main
Process: com.example.me.pokemon, PID: 17041
W/ActivityManager: Force finishing activity com.example.me.pokemon/.MainActivity
Version: 0.3.0, Android 6.0
You have to catch all exceptions with a try catch.
Yea, that actually did the trick. I though that solution was more complicated.