diff --git a/app/build.gradle b/app/build.gradle
index ea82af196..4e1f4d2ec 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,5 +1,4 @@
apply plugin: 'com.android.application'
-apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 25
@@ -21,50 +20,8 @@ android {
lintOptions {
disable 'GoogleAppIndexingWarning','GoogleAppIndexingApiWarning'
}
- sourceSets {
- debug {
- java {
- srcDirs 'src/main/java', "${buildDir}/generated/source/proto/debug/javalite"
- }
- }
- release {
- java {
- srcDirs 'src/main/java', "${buildDir}/generated/source/proto/release/javalite"
- }
- }
- main {
- proto {
- srcDir 'src/main/proto'
- }
- }
- }
}
dependencies {
- compile group: 'com.google.protobuf', name: 'protobuf-lite', version: '3.0.0'
- compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.5.0'
+ compile 'com.github.yeriomin:play-store-api:2eee3e034b'
}
-
-protobuf {
- protoc {
- artifact = 'com.google.protobuf:protoc:3.0.0'
- }
- plugins {
- grpc {
- artifact = 'io.grpc:protoc-gen-grpc-java:1.0.1'
- }
- javalite {
- artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
- }
- }
- generateProtoTasks {
- all()*.plugins {
- javalite { }
- }
- ofNonTest()*.plugins {
- grpc {
- option 'lite'
- }
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/yeriomin/playstoreapi/DeviceInfoProvider.java b/app/src/main/java/com/github/yeriomin/playstoreapi/DeviceInfoProvider.java
deleted file mode 100644
index 661d13425..000000000
--- a/app/src/main/java/com/github/yeriomin/playstoreapi/DeviceInfoProvider.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.github.yeriomin.playstoreapi;
-
-public interface DeviceInfoProvider {
-
- AndroidCheckinRequest generateAndroidCheckinRequest();
- DeviceConfigurationProto getDeviceConfigurationProto();
- String getUserAgentString();
- int getSdkVersion();
-}
diff --git a/app/src/main/java/com/github/yeriomin/playstoreapi/GooglePlayAPI.java b/app/src/main/java/com/github/yeriomin/playstoreapi/GooglePlayAPI.java
deleted file mode 100644
index 19f8b862d..000000000
--- a/app/src/main/java/com/github/yeriomin/playstoreapi/GooglePlayAPI.java
+++ /dev/null
@@ -1,436 +0,0 @@
-package com.github.yeriomin.playstoreapi;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * This class provides
- * checkin, search, details, bulkDetails, browse, list and download
- * capabilities. It uses Apache Commons HttpClient for POST and GET
- * requests.
- *
- *
- * XXX : DO NOT call checkin, login and download consecutively. To allow - * server to catch up, sleep for a while before download! (5 sec will do!) Also - * it is recommended to call checkin once and use generated android-id for - * further operations. - *
- * - * @author akdeniz - */ -public class GooglePlayAPI { - - private static final String SCHEME = "https://"; - private static final String HOST = "android.clients.google.com"; - private static final String CHECKIN_URL = SCHEME + HOST + "/checkin"; - private static final String URL_LOGIN = SCHEME + HOST + "/auth"; - private static final String C2DM_REGISTER_URL = SCHEME + HOST + "/c2dm/register2"; - private static final String FDFE_URL = SCHEME + HOST + "/fdfe/"; - private static final String LIST_URL = FDFE_URL + "list"; - private static final String BROWSE_URL = FDFE_URL + "browse"; - private static final String DETAILS_URL = FDFE_URL + "details"; - private static final String SEARCH_URL = FDFE_URL + "search"; - private static final String BULKDETAILS_URL = FDFE_URL + "bulkDetails"; - private static final String PURCHASE_URL = FDFE_URL + "purchase"; - private static final String REVIEWS_URL = FDFE_URL + "rev"; - private static final String UPLOADDEVICECONFIG_URL = FDFE_URL + "uploadDeviceConfig"; - private static final String RECOMMENDATIONS_URL = FDFE_URL + "rec"; - - private static final String ACCOUNT_TYPE_HOSTED_OR_GOOGLE = "HOSTED_OR_GOOGLE"; - - public enum REVIEW_SORT { - NEWEST(0), HIGHRATING(1), HELPFUL(2); - - public int value; - - REVIEW_SORT(int value) { - this.value = value; - } - } - - public enum RECOMMENDATION_TYPE { - ALSO_VIEWED(1), ALSO_INSTALLED(2); - - public int value; - - RECOMMENDATION_TYPE(int value) { - this.value = value; - } - } - - private String token; - private String gsfId; - private String email; - private String password; - private ThrottledOkHttpClient client; - private Locale locale; - private DeviceInfoProvider deviceInfoProvider; - private Mapcheckin() or set by using setGsfId before
- * using other abilities.
- */
- public GooglePlayAPI(String email, String password) {
- this.email = email;
- this.password = password;
- }
-
- /**
- * Performs authentication on "ac2dm" service and match up android id,
- * security token and email by checking them in on this server.
- *
- * This function sets check-inded android ID and that can be taken either by
- * using
- *
- * client_sig is SHA1 digest of encoded certificate on
- * GoogleLoginService(package name : com.google.android.gsf) system APK.
- * But google doesn't seem to care of value of this parameter.
- */
- public String getAC2DMToken() throws IOException {
- Map
- * Default values for offset and numberOfResult are "0" and "20"
- * respectively. These values are determined by Google Play Store.
- */
- public ListResponse list(String categoryId, String subCategoryId, Integer offset, Integer numberOfResults) throws IOException {
- Map
- * Default values for offset and numberOfResult are "0" and "20"
- * respectively. These values are determined by Google Play Store.
- */
- public ReviewResponse reviews(String packageName, REVIEW_SORT sort, Integer offset, Integer numberOfResults) throws IOException {
- Map
- * Default values for offset and numberOfResult are "0" and "20"
- * respectively. These values are determined by Google Play Store.
- */
- public ListResponse recommendations(String packageName, RECOMMENDATION_TYPE type, Integer offset, Integer numberOfResults) throws IOException {
- Map
-// * http://www.glbenchmark.com/phonedetails.jsp?benchmark=glpro25&D=Samsung
-// * +GT-I9300+Galaxy+S+III&testgroup=system
-// */
-// public static AndroidCheckinRequest generateAndroidCheckinRequest() {
-//
-// return AndroidCheckinRequest
-// .newBuilder()
-// .setId(0)
-// .setCheckin(
-// AndroidCheckinProto.newBuilder()
-// .setBuild(
-// AndroidBuildProto.newBuilder()
-// .setId(Build.FINGERPRINT)
-// .setProduct(Build.HARDWARE)
-// .setCarrier(Build.BRAND)
-// .setRadio(Build.RADIO)
-// .setBootloader(Build.BOOTLOADER)
-// .setDevice(Build.DEVICE)
-// .setSdkVersion(Build.VERSION.SDK_INT)
-// .setModel(Build.MODEL)
-// .setManufacturer(Build.MANUFACTURER)
-// .setBuildProduct(Build.PRODUCT)
-// .setClient("android-google")
-// .setOtaInstalled(false)
-// .setTimestamp(new Date().getTime() / 1000)
-// .setGoogleServices(16)
-// )
-// .setLastCheckinMsec(0)
-// .setCellOperator("310260")
-// .setSimOperator("310260")
-// .setRoaming("mobile-notroaming")
-// .setUserNumber(0)
-// )
-// .setLocale(Locale.getDefault().toString())
-// .setTimeZone(TimeZone.getDefault().getID())
-// .setVersion(3)
-// .setDeviceConfiguration(getDeviceConfigurationProto())
-// .setFragment(0)
-// .build();
-// }
-//
-// public static AndroidCheckinRequest generateAndroidCheckinRequestOriginal() {
-//
-// return AndroidCheckinRequest
-// .newBuilder()
-// .setId(0)
-// .setCheckin(
-// AndroidCheckinProto.newBuilder()
-// .setBuild(
-// AndroidBuildProto.newBuilder()
-// .setId("samsung/m0xx/m0:4.0.4/IMM76D/I9300XXALF2:user/release-keys")
-// .setProduct("smdk4x12")
-// .setCarrier("Google")
-// .setRadio("I9300XXALF2")
-// .setBootloader("PRIMELA03")
-// .setClient("android-google")
-// .setTimestamp(new Date().getTime() / 1000)
-// .setGoogleServices(16)
-// .setDevice("m0")
-// .setSdkVersion(16)
-// .setModel("GT-I9300")
-// .setManufacturer("Samsung")
-// .setBuildProduct("m0xx")
-// .setOtaInstalled(false)
-// )
-// .setLastCheckinMsec(0)
-// .setCellOperator("310260")
-// .setSimOperator("310260")
-// .setRoaming("mobile-notroaming")
-// .setUserNumber(0)
-// )
-// .setLocale("en_US")
-// .setTimeZone("Europe/Istanbul")
-// .setVersion(3)
-// .setDeviceConfiguration(getDeviceConfigurationProto())
-// .setFragment(0)
-// .build();
-// }
-//
-// public static AndroidCheckinRequest generateAndroidCheckinRequestNviennot() {
-//
-// return AndroidCheckinRequest
-// .newBuilder()
-// .setId(0)
-// .setCheckin(
-// AndroidCheckinProto.newBuilder()
-// .setBuild(
-// AndroidBuildProto.newBuilder()
-// .setId("google/yakju/maguro:4.1.1/JRO03C/398337:user/release-keys")
-// .setProduct("tuna")
-// .setCarrier("Google")
-// .setRadio("I9250XXLA2")
-// .setBootloader("PRIMELA03")
-// .setClient("android-google")
-// .setTimestamp(new Date().getTime()/1000)
-// .setGoogleServices(16)
-// .setDevice("maguro")
-// .setSdkVersion(16)
-// .setModel("Galaxy Nexus")
-// .setManufacturer("Samsung")
-// .setBuildProduct("yakju")
-// .setOtaInstalled(false)
-// )
-// .setLastCheckinMsec(0)
-// .setCellOperator("310260")
-// .setSimOperator("310260")
-// .setRoaming("mobile-notroaming")
-// .setUserNumber(0)
-// )
-// .setLocale("en_US")
-// .setTimeZone("Europe/Istanbul")
-// .setVersion(3)
-// .setDeviceConfiguration(getDeviceConfigurationProto())
-// .setFragment(0)
-// .build();
-// }
-//
-// public static AndroidCheckinRequest generateAndroidCheckinRequestRacoon() {
-//
-// return AndroidCheckinRequest
-// .newBuilder()
-// .setId(0)
-// .setCheckin(
-// AndroidCheckinProto.newBuilder()
-// .setBuild(
-// AndroidBuildProto.newBuilder()
-// .setId("samsung/nobleltejv/noblelte:6.0.1/MMB29K/N920CXXU2BPD6:user/release-keys")
-// .setProduct("noblelte")
-// .setCarrier("Google")
-// .setRadio("I9300XXALF2")
-// .setBootloader("PRIMELA03")
-// .setClient("android-google")
-// .setTimestamp(new Date().getTime() / 1000)
-// .setGoogleServices(16)
-// .setDevice("noblelte")
-// .setSdkVersion(23)
-// .setModel("SM-N920C")
-// .setManufacturer("Samsung")
-// .setBuildProduct("noblelte")
-// .setOtaInstalled(false)
-// )
-// .setLastCheckinMsec(0)
-// .setCellOperator("310260")
-// .setSimOperator("310260")
-// .setRoaming("mobile-notroaming")
-// .setUserNumber(0)
-// )
-// .setLocale("en_US")
-// .setTimeZone("Europe/Berlin")
-// .setVersion(3)
-// .setDeviceConfiguration(getDeviceConfigurationProto())
-// .setFragment(0)
-// .build();
-// }
-//
-// public static DeviceConfigurationProto getDeviceConfigurationProtoAAAAA() {
-//// DisplayMetrics metrics = new DisplayMetrics();
-//// WindowManager wm = (WindowManager) this.context.getSystemService(Context.WINDOW_SERVICE);
-//// wm.getDefaultDisplay().getMetrics(metrics);
-// return DeviceConfigurationProto.newBuilder()
-// .setTouchScreen(3)
-// .setKeyboard(1)
-// .setNavigation(1)
-// .setScreenLayout(2)
-// .setHasHardKeyboard(false)
-// .setHasFiveWayNavigation(false)
-// .setScreenDensity(320)
-// .setScreenWidth(720)
-// .setScreenHeight(1184)
-// .setGlEsVersion(131072)
-// .addAllNativePlatform(Arrays.asList(Build.CPU_ABI, Build.CPU_ABI2))
-//// .addAllNativePlatform(Arrays.asList("armeabi-v7a", "armeabi"))
-// .addAllSystemSharedLibrary(
-// Arrays.asList("android.test.runner", "com.android.future.usb.accessory", "com.android.location.provider",
-// "com.android.nfc_extras", "com.google.android.maps", "com.google.android.media.effects",
-// "com.google.widevine.software.drm", "javax.obex"))
-// .addAllSystemAvailableFeature(
-// Arrays.asList("android.hardware.bluetooth", "android.hardware.camera",
-// "android.hardware.camera.autofocus", "android.hardware.camera.flash",
-// "android.hardware.camera.front", "android.hardware.faketouch", "android.hardware.location",
-// "android.hardware.location.gps", "android.hardware.location.network",
-// "android.hardware.microphone", "android.hardware.nfc", "android.hardware.screen.landscape",
-// "android.hardware.screen.portrait", "android.hardware.sensor.accelerometer",
-// "android.hardware.sensor.barometer", "android.hardware.sensor.compass",
-// "android.hardware.sensor.gyroscope", "android.hardware.sensor.light",
-// "android.hardware.sensor.proximity", "android.hardware.telephony",
-// "android.hardware.telephony.gsm", "android.hardware.touchscreen",
-// "android.hardware.touchscreen.multitouch", "android.hardware.touchscreen.multitouch.distinct",
-// "android.hardware.touchscreen.multitouch.jazzhand", "android.hardware.usb.accessory",
-// "android.hardware.usb.host", "android.hardware.wifi", "android.hardware.wifi.direct",
-// "android.software.live_wallpaper", "android.software.sip", "android.software.sip.voip",
-// "com.cyanogenmod.android", "com.cyanogenmod.nfc.enhanced",
-// "com.google.android.feature.GOOGLE_BUILD", "com.nxp.mifare", "com.tmobile.software.themes"))
-// .addAllSystemSupportedLocale(
-// Arrays.asList("af", "af_ZA", "am", "am_ET", "ar", "ar_EG", "bg", "bg_BG", "ca", "ca_ES", "cs", "cs_CZ",
-// "da", "da_DK", "de", "de_AT", "de_CH", "de_DE", "de_LI", "el", "el_GR", "en", "en_AU", "en_CA",
-// "en_GB", "en_NZ", "en_SG", "en_US", "es", "es_ES", "es_US", "fa", "fa_IR", "fi", "fi_FI", "fr",
-// "fr_BE", "fr_CA", "fr_CH", "fr_FR", "hi", "hi_IN", "hr", "hr_HR", "hu", "hu_HU", "in", "in_ID",
-// "it", "it_CH", "it_IT", "iw", "iw_IL", "ja", "ja_JP", "ko", "ko_KR", "lt", "lt_LT", "lv",
-// "lv_LV", "ms", "ms_MY", "nb", "nb_NO", "nl", "nl_BE", "nl_NL", "pl", "pl_PL", "pt", "pt_BR",
-// "pt_PT", "rm", "rm_CH", "ro", "ro_RO", "ru", "ru_RU", "sk", "sk_SK", "sl", "sl_SI", "sr",
-// "sr_RS", "sv", "sv_SE", "sw", "sw_TZ", "th", "th_TH", "tl", "tl_PH", "tr", "tr_TR", "ug",
-// "ug_CN", "uk", "uk_UA", "vi", "vi_VN", "zh_CN", "zh_TW", "zu", "zu_ZA"))
-// .addAllGlExtension(
-// Arrays.asList("GL_EXT_debug_marker", "GL_EXT_discard_framebuffer", "GL_EXT_multi_draw_arrays",
-// "GL_EXT_shader_texture_lod", "GL_EXT_texture_format_BGRA8888",
-// "GL_IMG_multisampled_render_to_texture", "GL_IMG_program_binary", "GL_IMG_read_format",
-// "GL_IMG_shader_binary", "GL_IMG_texture_compression_pvrtc", "GL_IMG_texture_format_BGRA8888",
-// "GL_IMG_texture_npot", "GL_IMG_vertex_array_object", "GL_OES_EGL_image",
-// "GL_OES_EGL_image_external", "GL_OES_blend_equation_separate", "GL_OES_blend_func_separate",
-// "GL_OES_blend_subtract", "GL_OES_byte_coordinates", "GL_OES_compressed_ETC1_RGB8_texture",
-// "GL_OES_compressed_paletted_texture", "GL_OES_depth24", "GL_OES_depth_texture",
-// "GL_OES_draw_texture", "GL_OES_egl_sync", "GL_OES_element_index_uint",
-// "GL_OES_extended_matrix_palette", "GL_OES_fixed_point", "GL_OES_fragment_precision_high",
-// "GL_OES_framebuffer_object", "GL_OES_get_program_binary", "GL_OES_mapbuffer",
-// "GL_OES_matrix_get", "GL_OES_matrix_palette", "GL_OES_packed_depth_stencil",
-// "GL_OES_point_size_array", "GL_OES_point_sprite", "GL_OES_query_matrix", "GL_OES_read_format",
-// "GL_OES_required_internalformat", "GL_OES_rgb8_rgba8", "GL_OES_single_precision",
-// "GL_OES_standard_derivatives", "GL_OES_stencil8", "GL_OES_stencil_wrap",
-// "GL_OES_texture_cube_map", "GL_OES_texture_env_crossbar", "GL_OES_texture_float",
-// "GL_OES_texture_half_float", "GL_OES_texture_mirrored_repeat", "GL_OES_vertex_array_object",
-// "GL_OES_vertex_half_float")).build();
-// }
-}
diff --git a/build.gradle b/build.gradle
index 14c47cf07..e0de0c261 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,6 +12,7 @@ buildscript {
allprojects {
repositories {
+ maven { url 'https://jitpack.io' }
jcenter()
}
}
getToken() or from returned
- * {@link AndroidCheckinResponse} instance.
- */
- public String getGsfId() throws IOException {
- AndroidCheckinRequest request = this.deviceInfoProvider.generateAndroidCheckinRequest();
-
- // this first checkin is for generating android-id
- AndroidCheckinResponse checkinResponse = checkin(request.toByteArray());
- this.gsfId = BigInteger.valueOf(checkinResponse.getAndroidId()).toString(16);
- String securityToken = BigInteger.valueOf(checkinResponse.getSecurityToken()).toString(16);
-
- AndroidCheckinRequest.Builder checkInbuilder = AndroidCheckinRequest.newBuilder(request);
- String AC2DMToken = getAC2DMToken();
- AndroidCheckinRequest build = checkInbuilder
- .setId(new BigInteger(this.gsfId, 16).longValue())
- .setSecurityToken(new BigInteger(securityToken, 16).longValue())
- .addAccountCookie("[" + this.email + "]")
- .addAccountCookie(AC2DMToken)
- .build();
- // this is the second checkin to match credentials with android-id
- checkin(build.toByteArray());
- return this.gsfId;
- }
-
- /**
- * Posts given check-in request content and returns
- * {@link AndroidCheckinResponse}.
- */
- private AndroidCheckinResponse checkin(byte[] request) throws IOException {
- Mapsearch(query, null, null)
- */
- public SearchResponse search(String query) throws IOException {
- return search(query, null, null);
- }
-
- /**
- * Fetches a search results for given query. Offset and numberOfResults
- * parameters are optional and null can be passed!
- *
- * Warning! offset and numberOfResults do not seem to work anymore.
- * The api always returns first 30 results. Fetching further results is done through
- * nextPageUrl returned with the search result.
- */
- public SearchResponse search(String query, Integer offset, Integer numberOfResults) throws IOException {
- String url = SEARCH_URL;
- MapbulkDetails.
- */
- public DetailsResponse details(String packageName) throws IOException {
- Maplist(categoryId, null, null, null). It fetches
- * sub-categories of given category!
- */
- public ListResponse list(String categoryId) throws IOException {
- return list(categoryId, null, null, null);
- }
-
- /**
- * Fetches applications within supplied category and sub-category. If
- * null is given for sub-category, it fetches sub-categories of
- * passed category.
- *