Showing
11 changed files
with
94 additions
and
61 deletions
| 1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' | 
| 2 | 2 | ||
| 3 | android { | 3 | android { | 
| 4 | - compileSdkVersion 31 | 4 | + compileSdkVersion 33 | 
| 5 | - buildToolsVersion "31.0.0" | 5 | + buildToolsVersion "33.0.2" | 
| 6 | 6 | ||
| 7 | defaultConfig { | 7 | defaultConfig { | 
| 8 | applicationId "warp.ly.android_sdk" | 8 | applicationId "warp.ly.android_sdk" | 
| 9 | minSdkVersion 23 | 9 | minSdkVersion 23 | 
| 10 | - targetSdkVersion 31 | 10 | + targetSdkVersion 33 | 
| 11 | versionCode 100 | 11 | versionCode 100 | 
| 12 | versionName "1.0.0" | 12 | versionName "1.0.0" | 
| 13 | } | 13 | } | 
| ... | @@ -46,8 +46,8 @@ dependencies { | ... | @@ -46,8 +46,8 @@ dependencies { | 
| 46 | implementation project(':warply_android_sdk') | 46 | implementation project(':warply_android_sdk') | 
| 47 | 47 | ||
| 48 | //Support | 48 | //Support | 
| 49 | - implementation 'androidx.appcompat:appcompat:1.4.1' | 49 | + implementation 'androidx.appcompat:appcompat:1.6.1' | 
| 50 | - implementation 'androidx.recyclerview:recyclerview:1.2.1' | 50 | + implementation 'androidx.recyclerview:recyclerview:1.3.0' | 
| 51 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | 51 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | 
| 52 | 52 | ||
| 53 | implementation 'org.altbeacon:android-beacon-library:2.19.3' | 53 | implementation 'org.altbeacon:android-beacon-library:2.19.3' | ... | ... | 
| 1 | # {@link ly.warp.sdk.utils.WarplyProperty} | 1 | # {@link ly.warp.sdk.utils.WarplyProperty} | 
| 2 | 2 | ||
| 3 | # The app uuid the warply sdk need to connect to the engage server | 3 | # The app uuid the warply sdk need to connect to the engage server | 
| 4 | -Uuid= | 4 | +Uuid=b13ade8ef743468b89a7aaa8efbfc468 | 
| 5 | 5 | ||
| 6 | # If we need to see logs in Logcat | 6 | # If we need to see logs in Logcat | 
| 7 | Debug=false | 7 | Debug=false | ... | ... | 
| ... | @@ -79,7 +79,6 @@ public class SplashActivity extends BaseActivity { | ... | @@ -79,7 +79,6 @@ public class SplashActivity extends BaseActivity { | 
| 79 | runOnUiThread(new Runnable() { | 79 | runOnUiThread(new Runnable() { | 
| 80 | public void run() { | 80 | public void run() { | 
| 81 | if (!isFinishing()) { | 81 | if (!isFinishing()) { | 
| 82 | - Warply.registerGCM(SENDER_ID); | ||
| 83 | startActivity(new Intent(SplashActivity.this, | 82 | startActivity(new Intent(SplashActivity.this, | 
| 84 | MainActivity.class)); | 83 | MainActivity.class)); | 
| 85 | finish(); | 84 | finish(); | ... | ... | 
| ... | @@ -9,8 +9,8 @@ buildscript { | ... | @@ -9,8 +9,8 @@ buildscript { | 
| 9 | } | 9 | } | 
| 10 | dependencies { | 10 | dependencies { | 
| 11 | classpath 'com.android.tools.build:gradle:7.0.4' | 11 | classpath 'com.android.tools.build:gradle:7.0.4' | 
| 12 | - classpath 'com.google.gms:google-services:4.3.10' | 12 | + classpath 'com.google.gms:google-services:4.3.15' | 
| 13 | - classpath 'com.huawei.agconnect:agcp:1.6.2.300' | 13 | + classpath 'com.huawei.agconnect:agcp:1.7.2.300' | 
| 14 | classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' | 14 | classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' | 
| 15 | 15 | ||
| 16 | // NOTE: Do not place your application dependencies here; they belong | 16 | // NOTE: Do not place your application dependencies here; they belong | ... | ... | 
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | 
| 2 | 2 | ||
| 3 | ext { | 3 | ext { | 
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' | 
| 5 | - PUBLISH_VERSION = '4.5.4.6' | 5 | + PUBLISH_VERSION = '4.5.5.0' | 
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 
| 7 | } | 7 | } | 
| 8 | 8 | ||
| ... | @@ -10,18 +10,30 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" | ... | @@ -10,18 +10,30 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" | 
| 10 | 10 | ||
| 11 | android { | 11 | android { | 
| 12 | 12 | ||
| 13 | - compileSdkVersion 31 | 13 | + compileSdkVersion 33 | 
| 14 | - buildToolsVersion "31.0.0" | 14 | + buildToolsVersion "33.0.2" | 
| 15 | 15 | ||
| 16 | defaultConfig { | 16 | defaultConfig { | 
| 17 | minSdkVersion 23 | 17 | minSdkVersion 23 | 
| 18 | - targetSdkVersion 31 | 18 | + targetSdkVersion 33 | 
| 19 | consumerProguardFiles 'proguard-rules.pro' | 19 | consumerProguardFiles 'proguard-rules.pro' | 
| 20 | } | 20 | } | 
| 21 | + splits { | ||
| 22 | + abi { | ||
| 23 | + reset() | ||
| 24 | + enable false | ||
| 25 | + universalApk false // If true, also generate a universal APK | ||
| 26 | + include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" | ||
| 27 | + } | ||
| 28 | + } | ||
| 21 | lintOptions { | 29 | lintOptions { | 
| 22 | abortOnError false | 30 | abortOnError false | 
| 23 | } | 31 | } | 
| 24 | - | 32 | + sourceSets { | 
| 33 | + main { | ||
| 34 | + jniLibs.srcDirs = ['src/main/jniLibs'] | ||
| 35 | + } | ||
| 36 | + } | ||
| 25 | buildTypes { | 37 | buildTypes { | 
| 26 | release { | 38 | release { | 
| 27 | minifyEnabled false | 39 | minifyEnabled false | 
| ... | @@ -34,38 +46,38 @@ android { | ... | @@ -34,38 +46,38 @@ android { | 
| 34 | 46 | ||
| 35 | dependencies { | 47 | dependencies { | 
| 36 | //------------------------------ Support -----------------------------// | 48 | //------------------------------ Support -----------------------------// | 
| 37 | - api 'androidx.appcompat:appcompat:1.4.1' | 49 | + api 'androidx.appcompat:appcompat:1.6.1' | 
| 38 | - api 'androidx.recyclerview:recyclerview:1.2.1' | 50 | + api 'androidx.recyclerview:recyclerview:1.3.0' | 
| 39 | api 'androidx.cardview:cardview:1.0.0' | 51 | api 'androidx.cardview:cardview:1.0.0' | 
| 40 | - api "androidx.security:security-crypto:1.1.0-alpha03" // For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha | 52 | + api 'androidx.security:security-crypto:1.1.0-alpha06' // For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha | 
| 41 | api 'org.altbeacon:android-beacon-library:2.19.3' | 53 | api 'org.altbeacon:android-beacon-library:2.19.3' | 
| 42 | api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' | 54 | api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' | 
| 43 | api "commons-logging:commons-logging:1.2" | 55 | api "commons-logging:commons-logging:1.2" | 
| 44 | 56 | ||
| 45 | //------------------------------ Firebase -----------------------------// | 57 | //------------------------------ Firebase -----------------------------// | 
| 46 | - api platform('com.google.firebase:firebase-bom:29.0.3') | 58 | + api platform('com.google.firebase:firebase-bom:32.0.0') | 
| 47 | api 'com.google.firebase:firebase-messaging' | 59 | api 'com.google.firebase:firebase-messaging' | 
| 48 | 60 | ||
| 49 | //------------------------------ GMS -----------------------------// | 61 | //------------------------------ GMS -----------------------------// | 
| 50 | - api 'com.google.android.gms:play-services-base:18.0.1' | 62 | + api 'com.google.android.gms:play-services-base:18.2.0' | 
| 51 | - api 'com.google.android.gms:play-services-location:19.0.1' | 63 | + api 'com.google.android.gms:play-services-location:21.0.1' | 
| 52 | 64 | ||
| 53 | //------------------------------ Work Manager -----------------------------// | 65 | //------------------------------ Work Manager -----------------------------// | 
| 54 | - api 'androidx.work:work-runtime:2.7.1' | 66 | + api 'androidx.work:work-runtime:2.8.1' | 
| 55 | 67 | ||
| 56 | //------------------------------ Glide -----------------------------// | 68 | //------------------------------ Glide -----------------------------// | 
| 57 | api 'com.github.bumptech.glide:glide:4.12.0' | 69 | api 'com.github.bumptech.glide:glide:4.12.0' | 
| 58 | annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' | 70 | annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' | 
| 59 | 71 | ||
| 60 | //------------------------------ Huawei -----------------------------// | 72 | //------------------------------ Huawei -----------------------------// | 
| 61 | - api 'com.huawei.agconnect:agconnect-core:1.7.2.300' | 73 | + api 'com.huawei.agconnect:agconnect-core:1.9.0.300' | 
| 62 | - api 'com.huawei.hms:base:6.6.0.300' | 74 | + api 'com.huawei.hms:base:6.9.0.300' | 
| 63 | - api 'com.huawei.hms:push:6.7.0.300' | 75 | + api 'com.huawei.hms:push:6.10.0.300' | 
| 64 | - api 'com.huawei.hms:ads-identifier:3.4.56.300' | 76 | + api 'com.huawei.hms:ads-identifier:3.4.62.300' | 
| 65 | 77 | ||
| 66 | //------------------------------ SQLCipher -----------------------------// | 78 | //------------------------------ SQLCipher -----------------------------// | 
| 67 | - api "net.zetetic:android-database-sqlcipher:4.5.0" | 79 | + api 'net.zetetic:android-database-sqlcipher:4.5.2' | 
| 68 | - api "androidx.sqlite:sqlite:2.2.0" | 80 | + api 'androidx.sqlite:sqlite:2.3.1' | 
| 69 | } | 81 | } | 
| 70 | 82 | ||
| 71 | // In every export please update the version number | 83 | // In every export please update the version number | ... | ... | 
| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ | 
| 11 | <uses-permission | 11 | <uses-permission | 
| 12 | android:name="android.permission.REQUEST_INSTALL_PACKAGES" | 12 | android:name="android.permission.REQUEST_INSTALL_PACKAGES" | 
| 13 | tools:node="remove" /> | 13 | tools:node="remove" /> | 
| 14 | + <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> | ||
| 14 | 15 | ||
| 15 | <application> | 16 | <application> | 
| 16 | <!-- For Huawei Push --> | 17 | <!-- For Huawei Push --> | ... | ... | 
| ... | @@ -158,7 +158,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -158,7 +158,7 @@ public class WarpViewActivity extends WarpBaseActivity { | 
| 158 | } | 158 | } | 
| 159 | } | 159 | } | 
| 160 | }); | 160 | }); | 
| 161 | - root.addView(progressBar, progressBarParams); | 161 | +// root.addView(progressBar, progressBarParams); | 
| 162 | setContentView(root); | 162 | setContentView(root); | 
| 163 | } | 163 | } | 
| 164 | 164 | ... | ... | 
| ... | @@ -103,6 +103,7 @@ public class HurlStack implements HttpStack { | ... | @@ -103,6 +103,7 @@ public class HurlStack implements HttpStack { | 
| 103 | } | 103 | } | 
| 104 | URL parsedUrl = new URL(url); | 104 | URL parsedUrl = new URL(url); | 
| 105 | HttpURLConnection connection = openConnection(parsedUrl, request); | 105 | HttpURLConnection connection = openConnection(parsedUrl, request); | 
| 106 | + connection.setInstanceFollowRedirects(false); | ||
| 106 | for (String headerName : map.keySet()) { | 107 | for (String headerName : map.keySet()) { | 
| 107 | connection.addRequestProperty(headerName, map.get(headerName)); | 108 | connection.addRequestProperty(headerName, map.get(headerName)); | 
| 108 | } | 109 | } | ... | ... | 
| ... | @@ -5,6 +5,7 @@ import android.content.Context; | ... | @@ -5,6 +5,7 @@ import android.content.Context; | 
| 5 | import android.content.pm.PackageManager; | 5 | import android.content.pm.PackageManager; | 
| 6 | import android.os.Handler; | 6 | import android.os.Handler; | 
| 7 | import android.os.HandlerThread; | 7 | import android.os.HandlerThread; | 
| 8 | + | ||
| 8 | import androidx.annotation.NonNull; | 9 | import androidx.annotation.NonNull; | 
| 9 | import androidx.annotation.Nullable; | 10 | import androidx.annotation.Nullable; | 
| 10 | import androidx.core.content.ContextCompat; | 11 | import androidx.core.content.ContextCompat; | 
| ... | @@ -26,7 +27,7 @@ import ly.warp.sdk.dexter.listener.multi.MultiplePermissionsListener; | ... | @@ -26,7 +27,7 @@ import ly.warp.sdk.dexter.listener.multi.MultiplePermissionsListener; | 
| 26 | /** | 27 | /** | 
| 27 | * Created by Antonis Moustakos on 3/28/2017. | 28 | * Created by Antonis Moustakos on 3/28/2017. | 
| 28 | */ | 29 | */ | 
| 29 | -public class PermissionsUtil{ | 30 | +public class PermissionsUtil { | 
| 30 | // =========================================================== | 31 | // =========================================================== | 
| 31 | // Constants | 32 | // Constants | 
| 32 | // =========================================================== | 33 | // =========================================================== | 
| ... | @@ -34,6 +35,7 @@ public class PermissionsUtil{ | ... | @@ -34,6 +35,7 @@ public class PermissionsUtil{ | 
| 34 | public static final String PERMISSION_LOCATION_FINE = android.Manifest.permission.ACCESS_FINE_LOCATION, | 35 | public static final String PERMISSION_LOCATION_FINE = android.Manifest.permission.ACCESS_FINE_LOCATION, | 
| 35 | PERMISSION_LOCATION_COARSE = android.Manifest.permission.ACCESS_COARSE_LOCATION, | 36 | PERMISSION_LOCATION_COARSE = android.Manifest.permission.ACCESS_COARSE_LOCATION, | 
| 36 | PERMISSION_PHONE_STATE = Manifest.permission.READ_PHONE_STATE, | 37 | PERMISSION_PHONE_STATE = Manifest.permission.READ_PHONE_STATE, | 
| 38 | + PERMISSION_POST_NOTIFICATIONS = Manifest.permission.POST_NOTIFICATIONS, | ||
| 37 | SAFE_PERMISSION_BLUETOOTH = Manifest.permission.BLUETOOTH; | 39 | SAFE_PERMISSION_BLUETOOTH = Manifest.permission.BLUETOOTH; | 
| 38 | // PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE; | 40 | // PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE; | 
| 39 | 41 | ||
| ... | @@ -42,6 +44,7 @@ public class PermissionsUtil{ | ... | @@ -42,6 +44,7 @@ public class PermissionsUtil{ | 
| 42 | // PERMISSION_LOCATION_COARSE, | 44 | // PERMISSION_LOCATION_COARSE, | 
| 43 | // PERMISSION_PHONE_STATE, | 45 | // PERMISSION_PHONE_STATE, | 
| 44 | // PERMISSION_WRITE_EXTERNAL | 46 | // PERMISSION_WRITE_EXTERNAL | 
| 47 | + PERMISSION_POST_NOTIFICATIONS | ||
| 45 | }; | 48 | }; | 
| 46 | 49 | ||
| 47 | // =========================================================== | 50 | // =========================================================== | 
| ... | @@ -64,7 +67,7 @@ public class PermissionsUtil{ | ... | @@ -64,7 +67,7 @@ public class PermissionsUtil{ | 
| 64 | this.context = new WeakReference<>(context); | 67 | this.context = new WeakReference<>(context); | 
| 65 | this.callback = callback; | 68 | this.callback = callback; | 
| 66 | this.requestedPerms = requestedPerms; | 69 | this.requestedPerms = requestedPerms; | 
| 67 | - if(this.requestedPerms == null) | 70 | + if (this.requestedPerms == null) | 
| 68 | this.requestedPerms = DANGEROUS_PERMISSIONS; | 71 | this.requestedPerms = DANGEROUS_PERMISSIONS; | 
| 69 | 72 | ||
| 70 | HandlerThread mHandlerThread = new HandlerThread("PermissionsUtil"); | 73 | HandlerThread mHandlerThread = new HandlerThread("PermissionsUtil"); | 
| ... | @@ -75,28 +78,31 @@ public class PermissionsUtil{ | ... | @@ -75,28 +78,31 @@ public class PermissionsUtil{ | 
| 75 | // =========================================================== | 78 | // =========================================================== | 
| 76 | // Methods | 79 | // Methods | 
| 77 | // =========================================================== | 80 | // =========================================================== | 
| 78 | - public boolean requestNeeded(){ | 81 | + public boolean requestNeeded() { | 
| 79 | - for(String p : requestedPerms) | 82 | + for (String p : requestedPerms) | 
| 80 | - if(!hasPermission(context.get(), p)) | 83 | + if (!hasPermission(context.get(), p)) | 
| 81 | return true; | 84 | return true; | 
| 82 | return false; | 85 | return false; | 
| 83 | } | 86 | } | 
| 84 | - public static boolean hasPermission(Context con, String permission){ | 87 | + | 
| 88 | + public static boolean hasPermission(Context con, String permission) { | ||
| 85 | return ContextCompat.checkSelfPermission(con, permission) == PackageManager.PERMISSION_GRANTED; | 89 | return ContextCompat.checkSelfPermission(con, permission) == PackageManager.PERMISSION_GRANTED; | 
| 86 | } | 90 | } | 
| 87 | - public void requestPermissions(){ | 91 | + | 
| 92 | + public void requestPermissions() { | ||
| 88 | final DexterBuilder builder = | 93 | final DexterBuilder builder = | 
| 89 | Dexter.withContext(context.get()) | 94 | Dexter.withContext(context.get()) | 
| 90 | .withPermissions(requestedPerms) | 95 | .withPermissions(requestedPerms) | 
| 91 | .withListener(new MultiplePermissionsListener() { | 96 | .withListener(new MultiplePermissionsListener() { | 
| 92 | @Override | 97 | @Override | 
| 93 | public void onPermissionsChecked(MultiplePermissionsReport report) { | 98 | public void onPermissionsChecked(MultiplePermissionsReport report) { | 
| 94 | - if(callback != null) | 99 | + if (callback != null) | 
| 95 | - if(report.areAllPermissionsGranted()) | 100 | + if (report.areAllPermissionsGranted()) | 
| 96 | callback.onPermissionsGranted(); | 101 | callback.onPermissionsGranted(); | 
| 97 | else | 102 | else | 
| 98 | callback.onPermissionDenied(report.getDeniedPermissionResponses()); | 103 | callback.onPermissionDenied(report.getDeniedPermissionResponses()); | 
| 99 | } | 104 | } | 
| 105 | + | ||
| 100 | @Override | 106 | @Override | 
| 101 | public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) { | 107 | public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) { | 
| 102 | //TODO: Rationale can be shown here | 108 | //TODO: Rationale can be shown here | 
| ... | @@ -106,7 +112,7 @@ public class PermissionsUtil{ | ... | @@ -106,7 +112,7 @@ public class PermissionsUtil{ | 
| 106 | .withErrorListener(new PermissionRequestErrorListener() { | 112 | .withErrorListener(new PermissionRequestErrorListener() { | 
| 107 | @Override | 113 | @Override | 
| 108 | public void onError(DexterError error) { | 114 | public void onError(DexterError error) { | 
| 109 | - if(callback != null) | 115 | + if (callback != null) | 
| 110 | callback.onError(error); | 116 | callback.onError(error); | 
| 111 | } | 117 | } | 
| 112 | }) | 118 | }) | 
| ... | @@ -115,8 +121,11 @@ public class PermissionsUtil{ | ... | @@ -115,8 +121,11 @@ public class PermissionsUtil{ | 
| 115 | handler.post( | 121 | handler.post( | 
| 116 | new Runnable() { | 122 | new Runnable() { | 
| 117 | public void run() { | 123 | public void run() { | 
| 118 | - while(!prefs.isForeground()) | 124 | + while (!prefs.isForeground()) | 
| 119 | - try {Thread.sleep(SLEEP_TIME);} catch (InterruptedException ignored) {} | 125 | + try { | 
| 126 | + Thread.sleep(SLEEP_TIME); | ||
| 127 | + } catch (InterruptedException ignored) { | ||
| 128 | + } | ||
| 120 | builder.check(); | 129 | builder.check(); | 
| 121 | } | 130 | } | 
| 122 | } | 131 | } | 
| ... | @@ -126,9 +135,11 @@ public class PermissionsUtil{ | ... | @@ -126,9 +135,11 @@ public class PermissionsUtil{ | 
| 126 | // =========================================================== | 135 | // =========================================================== | 
| 127 | // Inner and Anonymous Classes | 136 | // Inner and Anonymous Classes | 
| 128 | // =========================================================== | 137 | // =========================================================== | 
| 129 | - public interface PermissionCallback{ | 138 | + public interface PermissionCallback { | 
| 130 | void onPermissionDenied(List<PermissionDeniedResponse> denied); | 139 | void onPermissionDenied(List<PermissionDeniedResponse> denied); | 
| 140 | + | ||
| 131 | void onPermissionsGranted(); | 141 | void onPermissionsGranted(); | 
| 142 | + | ||
| 132 | void onError(DexterError error); | 143 | void onError(DexterError error); | 
| 133 | } | 144 | } | 
| 134 | 145 | ... | ... | 
| ... | @@ -6,7 +6,6 @@ import android.content.Context; | ... | @@ -6,7 +6,6 @@ import android.content.Context; | 
| 6 | import android.content.pm.PackageInfo; | 6 | import android.content.pm.PackageInfo; | 
| 7 | import android.content.pm.PackageManager; | 7 | import android.content.pm.PackageManager; | 
| 8 | import android.graphics.Point; | 8 | import android.graphics.Point; | 
| 9 | -import android.os.AsyncTask; | ||
| 10 | import android.os.Build; | 9 | import android.os.Build; | 
| 11 | import android.provider.Settings; | 10 | import android.provider.Settings; | 
| 12 | import android.telephony.TelephonyManager; | 11 | import android.telephony.TelephonyManager; | 
| ... | @@ -15,6 +14,9 @@ import android.util.Base64; | ... | @@ -15,6 +14,9 @@ import android.util.Base64; | 
| 15 | import android.view.Display; | 14 | import android.view.Display; | 
| 16 | import android.view.WindowManager; | 15 | import android.view.WindowManager; | 
| 17 | 16 | ||
| 17 | +import com.google.android.gms.common.ConnectionResult; | ||
| 18 | +import com.google.android.gms.common.GoogleApiAvailability; | ||
| 19 | + | ||
| 18 | import org.json.JSONArray; | 20 | import org.json.JSONArray; | 
| 19 | import org.json.JSONException; | 21 | import org.json.JSONException; | 
| 20 | import org.json.JSONObject; | 22 | import org.json.JSONObject; | 
| ... | @@ -25,6 +27,8 @@ import java.security.MessageDigest; | ... | @@ -25,6 +27,8 @@ import java.security.MessageDigest; | 
| 25 | import java.security.NoSuchAlgorithmException; | 27 | import java.security.NoSuchAlgorithmException; | 
| 26 | import java.util.Arrays; | 28 | import java.util.Arrays; | 
| 27 | import java.util.List; | 29 | import java.util.List; | 
| 30 | +import java.util.concurrent.ExecutorService; | ||
| 31 | +import java.util.concurrent.Executors; | ||
| 28 | 32 | ||
| 29 | import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; | 33 | import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; | 
| 30 | import ly.warp.sdk.utils.constants.WarpConstants; | 34 | import ly.warp.sdk.utils.constants.WarpConstants; | 
| ... | @@ -55,9 +59,9 @@ public class WarplyDeviceInfoCollector { | ... | @@ -55,9 +59,9 @@ public class WarplyDeviceInfoCollector { | 
| 55 | 59 | ||
| 56 | public void collectToJson(final SimpleCallbackReceiver<JSONObject> callback) { | 60 | public void collectToJson(final SimpleCallbackReceiver<JSONObject> callback) { | 
| 57 | JSONObject jObj = new JSONObject(); | 61 | JSONObject jObj = new JSONObject(); | 
| 58 | - new Thread(() -> { | 62 | + final ExecutorService executorDeviceInfo = Executors.newFixedThreadPool(1); | 
| 59 | - if (!Thread.currentThread().isInterrupted()) { | 63 | + executorDeviceInfo.submit(() -> { | 
| 60 | - if (isPackageInstalled("com.android.vending", mContext.getPackageManager())) { | 64 | + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) { | 
| 61 | //Google Play Services are available | 65 | //Google Play Services are available | 
| 62 | try { | 66 | try { | 
| 63 | jObj.putOpt("platform", "android"); | 67 | jObj.putOpt("platform", "android"); | 
| ... | @@ -116,18 +120,18 @@ public class WarplyDeviceInfoCollector { | ... | @@ -116,18 +120,18 @@ public class WarplyDeviceInfoCollector { | 
| 116 | WarpUtils.log("*************************************************"); | 120 | WarpUtils.log("*************************************************"); | 
| 117 | } | 121 | } | 
| 118 | } | 122 | } | 
| 119 | - } | 123 | + | 
| 120 | callback.onSuccess(jObj); | 124 | callback.onSuccess(jObj); | 
| 121 | - Thread.currentThread().interrupt(); | 125 | + executorDeviceInfo.shutdownNow(); | 
| 122 | - }).start(); | 126 | + }); | 
| 123 | } | 127 | } | 
| 124 | 128 | ||
| 125 | public void getRegistrationParams(final SimpleCallbackReceiver<JSONObject> callback) { | 129 | public void getRegistrationParams(final SimpleCallbackReceiver<JSONObject> callback) { | 
| 126 | JSONObject jObj = new JSONObject(); | 130 | JSONObject jObj = new JSONObject(); | 
| 127 | - new Thread(() -> { | 131 | + final ExecutorService executorRegParams = Executors.newFixedThreadPool(1); | 
| 128 | - if (!Thread.currentThread().isInterrupted()) { | 132 | + executorRegParams.submit(() -> { | 
| 129 | // For GoogleApiAvailability we need to add a meta tag in Manifest | 133 | // For GoogleApiAvailability we need to add a meta tag in Manifest | 
| 130 | - if (isPackageInstalled("com.android.vending", mContext.getPackageManager())) { | 134 | + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) { | 
| 131 | //Google Play Services are available | 135 | //Google Play Services are available | 
| 132 | try { | 136 | try { | 
| 133 | GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext); | 137 | GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext); | 
| ... | @@ -137,6 +141,8 @@ public class WarplyDeviceInfoCollector { | ... | @@ -137,6 +141,8 @@ public class WarplyDeviceInfoCollector { | 
| 137 | jObj.putOpt("android_device_id_new", getUniqueDeviceId()); | 141 | jObj.putOpt("android_device_id_new", getUniqueDeviceId()); | 
| 138 | jObj.putOpt("unique_device_id", getUniqueDeviceId()); | 142 | jObj.putOpt("unique_device_id", getUniqueDeviceId()); | 
| 139 | jObj.putOpt("platform", "android"); | 143 | jObj.putOpt("platform", "android"); | 
| 144 | + jObj.putOpt("manufacturer", getDeviceManufacturer()); | ||
| 145 | + jObj.putOpt("android_phone_model", getDeviceModel()); | ||
| 140 | jObj.putOpt("os_version", getOsVersion()); | 146 | jObj.putOpt("os_version", getOsVersion()); | 
| 141 | jObj.putOpt("vendor", "google"); | 147 | jObj.putOpt("vendor", "google"); | 
| 142 | jObj.putOpt("app_version", getAppVersion()); | 148 | jObj.putOpt("app_version", getAppVersion()); | 
| ... | @@ -155,6 +161,8 @@ public class WarplyDeviceInfoCollector { | ... | @@ -155,6 +161,8 @@ public class WarplyDeviceInfoCollector { | 
| 155 | jObj.putOpt("android_device_id_new", getUniqueDeviceId()); | 161 | jObj.putOpt("android_device_id_new", getUniqueDeviceId()); | 
| 156 | jObj.putOpt("unique_device_id", getUniqueDeviceId()); | 162 | jObj.putOpt("unique_device_id", getUniqueDeviceId()); | 
| 157 | jObj.putOpt("platform", "android"); | 163 | jObj.putOpt("platform", "android"); | 
| 164 | + jObj.putOpt("manufacturer", getDeviceManufacturer()); | ||
| 165 | + jObj.putOpt("android_phone_model", getDeviceModel()); | ||
| 158 | jObj.putOpt("os_version", getOsVersion()); | 166 | jObj.putOpt("os_version", getOsVersion()); | 
| 159 | jObj.putOpt("vendor", "huawei"); | 167 | jObj.putOpt("vendor", "huawei"); | 
| 160 | jObj.putOpt("app_version", getAppVersion()); | 168 | jObj.putOpt("app_version", getAppVersion()); | 
| ... | @@ -166,10 +174,10 @@ public class WarplyDeviceInfoCollector { | ... | @@ -166,10 +174,10 @@ public class WarplyDeviceInfoCollector { | 
| 166 | WarpUtils.log("*************************************************"); | 174 | WarpUtils.log("*************************************************"); | 
| 167 | } | 175 | } | 
| 168 | } | 176 | } | 
| 169 | - } | 177 | + | 
| 170 | callback.onSuccess(jObj); | 178 | callback.onSuccess(jObj); | 
| 171 | - Thread.currentThread().interrupt(); | 179 | + executorRegParams.shutdownNow(); | 
| 172 | - }).start(); | 180 | + }); | 
| 173 | } | 181 | } | 
| 174 | 182 | ||
| 175 | private String hashToString(int value) { | 183 | private String hashToString(int value) { | 
| ... | @@ -299,7 +307,7 @@ public class WarplyDeviceInfoCollector { | ... | @@ -299,7 +307,7 @@ public class WarplyDeviceInfoCollector { | 
| 299 | } | 307 | } | 
| 300 | 308 | ||
| 301 | public String getAdvertisementId() { | 309 | public String getAdvertisementId() { | 
| 302 | - if (isPackageInstalled("com.android.vending", mContext.getPackageManager())) { | 310 | + if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) { | 
| 303 | GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext); | 311 | GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext); | 
| 304 | return adInfo != null ? adInfo.getId() : ""; | 312 | return adInfo != null ? adInfo.getId() : ""; | 
| 305 | } else { | 313 | } else { | 
| ... | @@ -409,11 +417,12 @@ public class WarplyDeviceInfoCollector { | ... | @@ -409,11 +417,12 @@ public class WarplyDeviceInfoCollector { | 
| 409 | } | 417 | } | 
| 410 | 418 | ||
| 411 | public boolean isPackageInstalled(String packageName, PackageManager packageManager) { | 419 | public boolean isPackageInstalled(String packageName, PackageManager packageManager) { | 
| 412 | - try { | 420 | +// try { | 
| 413 | - return packageManager.getApplicationInfo(packageName, 0).enabled; | 421 | +// return packageManager.getApplicationInfo(packageName, 0).enabled; | 
| 414 | - } catch (PackageManager.NameNotFoundException e) { | 422 | +// } catch (PackageManager.NameNotFoundException e) { | 
| 415 | - return false; | 423 | +// return false; | 
| 416 | - } | 424 | +// } | 
| 425 | + return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS; | ||
| 417 | } | 426 | } | 
| 418 | 427 | ||
| 419 | // =========================================================== | 428 | // =========================================================== | ... | ... | 
| ... | @@ -117,7 +117,7 @@ public class WarpView extends WebView { | ... | @@ -117,7 +117,7 @@ public class WarpView extends WebView { | 
| 117 | setFadingEdgeLength(0); | 117 | setFadingEdgeLength(0); | 
| 118 | 118 | ||
| 119 | WebSettings settings = getSettings(); | 119 | WebSettings settings = getSettings(); | 
| 120 | - settings.setAppCacheEnabled(true); | 120 | + settings.setCacheMode(WebSettings.LOAD_DEFAULT); | 
| 121 | settings.setJavaScriptEnabled(true); | 121 | settings.setJavaScriptEnabled(true); | 
| 122 | settings.setDatabaseEnabled(true); | 122 | settings.setDatabaseEnabled(true); | 
| 123 | settings.setDomStorageEnabled(true); | 123 | settings.setDomStorageEnabled(true); | ... | ... | 
- 
Please register or login to post a comment
