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.akivamu:play-store-api:0.13'
}
dependencies {
implementation("com.github.akivamu:play-store-api:0.13")
}
<dependency>
<groupId>com.github.akivamu</groupId>
<artifactId>play-store-api</artifactId>
<version>0.13</version>
</dependency>
libraryDependencies += "com.github.akivamu" % "play-store-api" % "0.13"
:dependencies [[com.github.akivamu/play-store-api "0.13"]]
Google Play Store protobuf API wrapper in java
Get it from jitpack. Or...
git clone https://github.com/yeriomin/play-store-api
gradlew :assemble
gradlew :build
Protobuf classes generation happens on assemble step, tests a ran on build step.
// A device definition is required to log in
// See resources for a list of available devices
Properties properties = new Properties();
try {
properties.load(getClass().getClassLoader().getSystemResourceAsStream("device-honami.properties"));
} catch (IOException e) {
System.out.println("device-honami.properties not found");
return null;
}
PropertiesDeviceInfoProvider deviceInfoProvider = new PropertiesDeviceInfoProvider();
deviceInfoProvider.setProperties(properties);
deviceInfoProvider.setLocaleString(Locale.ENGLISH.toString());
// Provide valid google account info
PlayStoreApiBuilder builder = new PlayStoreApiBuilder()
// Extend HttpClientAdapter using a http library of your choice
.setHttpClient(new HttpClientAdapterImplementation())
.setDeviceInfoProvider(deviceInfoProvider)
.setEmail(email)
.setPassword(password)
;
GooglePlayAPI api = builder.build();
// We are logged in now
// Save and reuse the generated auth token and gsf id,
// unless you want to get banned for frequent relogins
// The token has a very long validity time. Months.
api.getToken();
api.getGsfId();
// API wrapper instance is ready
DetailsResponse response = api.details("com.cpuid.cpu_z");
// A device definition is required for routine requests too
// See resources for a list of available devices
Properties properties = new Properties();
try {
properties.load(getClass().getClassLoader().getSystemResourceAsStream("device-honami.properties"));
} catch (IOException e) {
System.out.println("device-honami.properties not found");
return null;
}
PropertiesDeviceInfoProvider deviceInfoProvider = new PropertiesDeviceInfoProvider();
deviceInfoProvider.setProperties(properties);
deviceInfoProvider.setLocaleString(Locale.ENGLISH.toString());
// Provide auth token and gsf id you previously saved
PlayStoreApiBuilder builder = new PlayStoreApiBuilder()
// Extend HttpClientAdapter using a http library of your choice
.setHttpClient(new HttpClientAdapterImplementation())
.setDeviceInfoProvider(deviceInfoProvider)
.setToken(token)
.setGsfId(gsfId)
;
GooglePlayAPI api = builder.build();
// API wrapper instance is ready
DetailsResponse response = api.details("com.cpuid.cpu_z");
See tests and the project which this library was made for for examples.
Looking through GooglePlay.proto will let you know what responses to expect.