Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.jabbink:PokeGOAPI-Java:'
}
dependencies {
implementation("com.github.jabbink:PokeGOAPI-Java:")
}
<dependency>
<groupId>com.github.jabbink</groupId>
<artifactId>PokeGOAPI-Java</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.jabbink" % "PokeGOAPI-Java" % ""
:dependencies [[com.github.jabbink/PokeGOAPI-Java ""]]
Pokemon GO Java API
See this guide for adding functionality: https://docs.google.com/document/d/1BE8O6Z19sQ54T5T7QauXgA11GbL6D9vx9AAMCM5KlRA
See this spreadsheet for RPC endpoints and progress : https://docs.google.com/spreadsheets/d/1Xv0Gw5PzIRaVou2xrl6r7qySrcmOKjQWLBjJA73YnJM
:exclamation:
This API may seem unstable. This is because the backend Pokemon GO servers are unstable.
In case stuff is not working as expected, wait a moment to see if the problem resolves itself automatically.
You may also check the status of the servers on IsPokemonGoDownOrNot.com or MMOServerStatus.com.
If you just want to use it, wait some days until the server issues are resolved (or if there is a problem with this library, you may fix it and send a PR this way).
:exclamation:
git submodule update --init
gradle build bundle
build/libs/PokeGOAPI-Java_bundle-0.0.1-SNAPSHOT.jar
PS : To eclipse user, you may build one time and add the generated java class for proto into eclipse path : Right click on the project > Build path > New Source Folder > Type 'build/generated/source/proto/main/java' > Finish
Include the API as jar from your own build, or use Maven/Gradle/SBT/Leiningen: https://jitpack.io/#Grover-c13/PokeGOAPI-Java/master-SNAPSHOT
Mostly everything is accessed through the PokemonGo class in the API package.
The constructor of PokemonGo class requires a AuthInfo object which can be obtained from GoogleLogin().login or PTCLogin().login, and a OkHttpClient object.
EG:
OkHttpClient httpClient = new OkHttpClient();
AuthInfo auth = new GoogleLogin(httpClient).login("token");
PokemonGo go = new PokemonGo(auth,httpClient);
Log.v(go.getPlayerProfile());
##Android Dev FAQ
You're running the sample code on the UI thread. Strict mode policy will throw an exception in that case and its being caught by the network client and treating it as a login failed exception. Run the sample code on a background thread in AsyncTask or RXJava and it will work.
This library is meant to be a Java implementation of the API. Google Volley is specific to Android and should not be introduced in this library. However, if you still want to refactor it, you should create it as a separate project.
git checkout -b my-new-feature
git commit -am 'Usefull information about your new features'
git push origin my-new-feature
You can join us in the slack channel #javaapi on the pkre.slack.com (you should get an invite by a bot posted somewhere in the subreddit /r/pokemongodev)