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

getMap().getCatchablePokemon() returns 0 often

Open ashgh opened this issue 10 years ago • 14 comments

This method often returns 0 for me with the latest changes. Are there other requirements to get this call to work? I am making sure my location is updated before the call and I am letting 1 second go by before making this call. For reference, I am navigating downtown San Diego.

ashgh avatar Aug 03 '16 18:08 ashgh

getCatchablePokemon() uses MapObjects. Wait atleast 10s between calls to solve this.

Jari27 avatar Aug 03 '16 18:08 Jari27

10s seems kind of long to wait. Is the alternative to subscribe to the async version?

ashgh avatar Aug 03 '16 18:08 ashgh

@ashgh you have to wait 10seconds before starting the next request. The request itself don´t need 10seconds.

FabianTerhorst avatar Aug 03 '16 18:08 FabianTerhorst

@FabianTerhorst so I have to wait 10s before each request that uses MapObjects. Could I theory cache getMap().getMapObjects() and refresh that every 10 seconds instead?

ashgh avatar Aug 03 '16 18:08 ashgh

@ashgh it works like you said. It is cached and refresh when you call it and the last refresh was more than 10s.

mgorski-mg avatar Aug 03 '16 18:08 mgorski-mg

@mgorski-zlatan oh ok, so it's already being cached and updated. so really if the call returns 0 pokemon, there isn't anything you can really do except wait 10 seconds for it to refresh?

ashgh avatar Aug 03 '16 19:08 ashgh

It's not being updated automatically, you still have to make a request that queries mapobjects.

Jari27 avatar Aug 03 '16 19:08 Jari27

@Sadye right, I have a thread that queries every second already. so as long as the request is being made, it will get updated every 10 seconds, is that right?

ashgh avatar Aug 03 '16 19:08 ashgh

That's right. If you are querying every 1s, it will send network request every 10s.

mgorski-mg avatar Aug 03 '16 20:08 mgorski-mg

@ashgh Take care that you are still receiving bullshit empty responses if something is wrong. Might want to catch those.

Jari27 avatar Aug 03 '16 20:08 Jari27

Are guys sure this is a throttling issue ? Looks to me something changed in the proto ?

PokeAlert avatar Aug 03 '16 21:08 PokeAlert

unfortunately you're right :( something is changed, probably in mapcell proto

mgorski-mg avatar Aug 03 '16 21:08 mgorski-mg

Yea, this looks broken to me like as of a couple hours ago.

aaiezza avatar Aug 03 '16 21:08 aaiezza

please refer to #486

vmarchaud avatar Aug 04 '16 12:08 vmarchaud