Search in sources :

Example 1 with SystemTimeImpl

use of com.pokegoapi.util.SystemTimeImpl in project PokeGOAPI-Java by Grover-c13.

the class UseIncenseExample method main.

/**
 * Catches a pokemon at an area.
 */
public static void main(String[] args) {
    OkHttpClient http = new OkHttpClient();
    PokemonGo api = new PokemonGo(http, new SystemTimeImpl());
    try {
        HashProvider hasher = ExampleConstants.getHashProvider();
        api.login(new PtcCredentialProvider(http, ExampleConstants.LOGIN, ExampleConstants.PASSWORD), hasher);
        api.setLocation(ExampleConstants.LATITUDE, ExampleConstants.LONGITUDE, ExampleConstants.ALTITUDE);
        api.inventories.itemBag.useIncense();
    } catch (RequestFailedException e) {
        // failed to login, invalid credentials, auth issue or server issue.
        Log.e("Main", "Failed to login, captcha or server issue: ", e);
    }
}
Also used : PtcCredentialProvider(com.pokegoapi.auth.PtcCredentialProvider) OkHttpClient(okhttp3.OkHttpClient) RequestFailedException(com.pokegoapi.exceptions.request.RequestFailedException) PokemonGo(com.pokegoapi.api.PokemonGo) SystemTimeImpl(com.pokegoapi.util.SystemTimeImpl) HashProvider(com.pokegoapi.util.hash.HashProvider)

Aggregations

PokemonGo (com.pokegoapi.api.PokemonGo)1 PtcCredentialProvider (com.pokegoapi.auth.PtcCredentialProvider)1 RequestFailedException (com.pokegoapi.exceptions.request.RequestFailedException)1 SystemTimeImpl (com.pokegoapi.util.SystemTimeImpl)1 HashProvider (com.pokegoapi.util.hash.HashProvider)1 OkHttpClient (okhttp3.OkHttpClient)1