PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

`FATAL EXCEPTION: main` when Internet connection drops

Open ivankoma opened this issue 10 years ago • 2 comments

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:

  1. Connect to PTC
  2. go.setLocation(lat, lon, alt);
  3. Disable Internet
  4. 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

ivankoma avatar Aug 12 '16 17:08 ivankoma

You have to catch all exceptions with a try catch.

FabianTerhorst avatar Aug 12 '16 18:08 FabianTerhorst

Yea, that actually did the trick. I though that solution was more complicated.

ivankoma avatar Aug 13 '16 14:08 ivankoma