Panagiotis Triantafyllou

android 13 support

apply plugin: 'com.android.application'
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
compileSdkVersion 33
buildToolsVersion "33.0.2"
defaultConfig {
applicationId "warp.ly.android_sdk"
minSdkVersion 23
targetSdkVersion 31
targetSdkVersion 33
versionCode 100
versionName "1.0.0"
}
......@@ -46,8 +46,8 @@ dependencies {
implementation project(':warply_android_sdk')
//Support
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'org.altbeacon:android-beacon-library:2.19.3'
......
# {@link ly.warp.sdk.utils.WarplyProperty}
# The app uuid the warply sdk need to connect to the engage server
Uuid=
Uuid=b13ade8ef743468b89a7aaa8efbfc468
# If we need to see logs in Logcat
Debug=false
......
......@@ -79,7 +79,6 @@ public class SplashActivity extends BaseActivity {
runOnUiThread(new Runnable() {
public void run() {
if (!isFinishing()) {
Warply.registerGCM(SENDER_ID);
startActivity(new Intent(SplashActivity.this,
MainActivity.class));
finish();
......
......@@ -9,8 +9,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.huawei.agconnect:agcp:1.6.2.300'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.huawei.agconnect:agcp:1.7.2.300'
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6'
PUBLISH_VERSION = '4.5.5.0'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -10,18 +10,30 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
compileSdkVersion 33
buildToolsVersion "33.0.2"
defaultConfig {
minSdkVersion 23
targetSdkVersion 31
targetSdkVersion 33
consumerProguardFiles 'proguard-rules.pro'
}
splits {
abi {
reset()
enable false
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
lintOptions {
abortOnError false
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
buildTypes {
release {
minifyEnabled false
......@@ -34,38 +46,38 @@ android {
dependencies {
//------------------------------ Support -----------------------------//
api 'androidx.appcompat:appcompat:1.4.1'
api 'androidx.recyclerview:recyclerview:1.2.1'
api 'androidx.appcompat:appcompat:1.6.1'
api 'androidx.recyclerview:recyclerview:1.3.0'
api 'androidx.cardview:cardview:1.0.0'
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
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
api 'org.altbeacon:android-beacon-library:2.19.3'
api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
api "commons-logging:commons-logging:1.2"
//------------------------------ Firebase -----------------------------//
api platform('com.google.firebase:firebase-bom:29.0.3')
api platform('com.google.firebase:firebase-bom:32.0.0')
api 'com.google.firebase:firebase-messaging'
//------------------------------ GMS -----------------------------//
api 'com.google.android.gms:play-services-base:18.0.1'
api 'com.google.android.gms:play-services-location:19.0.1'
api 'com.google.android.gms:play-services-base:18.2.0'
api 'com.google.android.gms:play-services-location:21.0.1'
//------------------------------ Work Manager -----------------------------//
api 'androidx.work:work-runtime:2.7.1'
api 'androidx.work:work-runtime:2.8.1'
//------------------------------ Glide -----------------------------//
api 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
//------------------------------ Huawei -----------------------------//
api 'com.huawei.agconnect:agconnect-core:1.7.2.300'
api 'com.huawei.hms:base:6.6.0.300'
api 'com.huawei.hms:push:6.7.0.300'
api 'com.huawei.hms:ads-identifier:3.4.56.300'
api 'com.huawei.agconnect:agconnect-core:1.9.0.300'
api 'com.huawei.hms:base:6.9.0.300'
api 'com.huawei.hms:push:6.10.0.300'
api 'com.huawei.hms:ads-identifier:3.4.62.300'
//------------------------------ SQLCipher -----------------------------//
api "net.zetetic:android-database-sqlcipher:4.5.0"
api "androidx.sqlite:sqlite:2.2.0"
api 'net.zetetic:android-database-sqlcipher:4.5.2'
api 'androidx.sqlite:sqlite:2.3.1'
}
// In every export please update the version number
......
......@@ -11,6 +11,7 @@
<uses-permission
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
tools:node="remove" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application>
<!-- For Huawei Push -->
......
......@@ -158,7 +158,7 @@ public class WarpViewActivity extends WarpBaseActivity {
}
}
});
root.addView(progressBar, progressBarParams);
// root.addView(progressBar, progressBarParams);
setContentView(root);
}
......
......@@ -103,6 +103,7 @@ public class HurlStack implements HttpStack {
}
URL parsedUrl = new URL(url);
HttpURLConnection connection = openConnection(parsedUrl, request);
connection.setInstanceFollowRedirects(false);
for (String headerName : map.keySet()) {
connection.addRequestProperty(headerName, map.get(headerName));
}
......
......@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.HandlerThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
......@@ -26,15 +27,16 @@ import ly.warp.sdk.dexter.listener.multi.MultiplePermissionsListener;
/**
* Created by Antonis Moustakos on 3/28/2017.
*/
public class PermissionsUtil{
public class PermissionsUtil {
// ===========================================================
// Constants
// ===========================================================
private static final int SLEEP_TIME = 5000;
public static final String PERMISSION_LOCATION_FINE = android.Manifest.permission.ACCESS_FINE_LOCATION,
PERMISSION_LOCATION_COARSE = android.Manifest.permission.ACCESS_COARSE_LOCATION,
PERMISSION_PHONE_STATE = Manifest.permission.READ_PHONE_STATE,
SAFE_PERMISSION_BLUETOOTH = Manifest.permission.BLUETOOTH;
PERMISSION_LOCATION_COARSE = android.Manifest.permission.ACCESS_COARSE_LOCATION,
PERMISSION_PHONE_STATE = Manifest.permission.READ_PHONE_STATE,
PERMISSION_POST_NOTIFICATIONS = Manifest.permission.POST_NOTIFICATIONS,
SAFE_PERMISSION_BLUETOOTH = Manifest.permission.BLUETOOTH;
// PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE;
private static final String[] DANGEROUS_PERMISSIONS = {
......@@ -42,6 +44,7 @@ public class PermissionsUtil{
// PERMISSION_LOCATION_COARSE,
// PERMISSION_PHONE_STATE,
// PERMISSION_WRITE_EXTERNAL
PERMISSION_POST_NOTIFICATIONS
};
// ===========================================================
......@@ -64,7 +67,7 @@ public class PermissionsUtil{
this.context = new WeakReference<>(context);
this.callback = callback;
this.requestedPerms = requestedPerms;
if(this.requestedPerms == null)
if (this.requestedPerms == null)
this.requestedPerms = DANGEROUS_PERMISSIONS;
HandlerThread mHandlerThread = new HandlerThread("PermissionsUtil");
......@@ -75,60 +78,68 @@ public class PermissionsUtil{
// ===========================================================
// Methods
// ===========================================================
public boolean requestNeeded(){
for(String p : requestedPerms)
if(!hasPermission(context.get(), p))
public boolean requestNeeded() {
for (String p : requestedPerms)
if (!hasPermission(context.get(), p))
return true;
return false;
}
public static boolean hasPermission(Context con, String permission){
public static boolean hasPermission(Context con, String permission) {
return ContextCompat.checkSelfPermission(con, permission) == PackageManager.PERMISSION_GRANTED;
}
public void requestPermissions(){
public void requestPermissions() {
final DexterBuilder builder =
Dexter.withContext(context.get())
.withPermissions(requestedPerms)
.withListener(new MultiplePermissionsListener() {
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
if(callback != null)
if(report.areAllPermissionsGranted())
callback.onPermissionsGranted();
else
callback.onPermissionDenied(report.getDeniedPermissionResponses());
}
@Override
public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
//TODO: Rationale can be shown here
token.continuePermissionRequest();
}
})
.withErrorListener(new PermissionRequestErrorListener() {
@Override
public void onError(DexterError error) {
if(callback != null)
callback.onError(error);
}
})
.onSameThread();
Dexter.withContext(context.get())
.withPermissions(requestedPerms)
.withListener(new MultiplePermissionsListener() {
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
if (callback != null)
if (report.areAllPermissionsGranted())
callback.onPermissionsGranted();
else
callback.onPermissionDenied(report.getDeniedPermissionResponses());
}
@Override
public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
//TODO: Rationale can be shown here
token.continuePermissionRequest();
}
})
.withErrorListener(new PermissionRequestErrorListener() {
@Override
public void onError(DexterError error) {
if (callback != null)
callback.onError(error);
}
})
.onSameThread();
handler.post(
new Runnable() {
public void run() {
while(!prefs.isForeground())
try {Thread.sleep(SLEEP_TIME);} catch (InterruptedException ignored) {}
builder.check();
new Runnable() {
public void run() {
while (!prefs.isForeground())
try {
Thread.sleep(SLEEP_TIME);
} catch (InterruptedException ignored) {
}
builder.check();
}
}
}
);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
public interface PermissionCallback{
public interface PermissionCallback {
void onPermissionDenied(List<PermissionDeniedResponse> denied);
void onPermissionsGranted();
void onError(DexterError error);
}
......
......@@ -6,7 +6,6 @@ import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.os.AsyncTask;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
......@@ -15,6 +14,9 @@ import android.util.Base64;
import android.view.Display;
import android.view.WindowManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -25,6 +27,8 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -55,121 +59,125 @@ public class WarplyDeviceInfoCollector {
public void collectToJson(final SimpleCallbackReceiver<JSONObject> callback) {
JSONObject jObj = new JSONObject();
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
if (isPackageInstalled("com.android.vending", mContext.getPackageManager())) {
//Google Play Services are available
try {
jObj.putOpt("platform", "android");
jObj.putOpt("vendor", "google");
jObj.putOpt("development", isInDevelopmentMode());
jObj.putOpt("carrier_name", getCarrierName());
jObj.putOpt("registration_gcm", getRegistrationGCM());
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("android_os_version", getOsVersion());
jObj.putOpt("android_os_api_level", getAndroidSDKVersion());
jObj.putOpt("android_device", getDeviceName());
jObj.putOpt("screen_resolution", getDisplayWidth() + "x" + getDisplayHeight());
GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext);
jObj.putOpt("advertising_id", adInfo != null ? adInfo.getId() : "");
jObj.putOpt("opt_out_of_interest_based_ads_enabled", adInfo != null ?
adInfo.isLimitAdTrackingEnabled() : "");
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
} catch (JSONException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Device Info JSON", e);
WarpUtils.log("*************************************************");
}
} else {
//Google Play Services are not available, or not updated
try {
jObj.putOpt("platform", "android");
jObj.putOpt("vendor", "huawei");
jObj.putOpt("development", isInDevelopmentMode());
jObj.putOpt("carrier_name", getCarrierName());
jObj.putOpt("registration_gcm", getRegistrationGCM());
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("android_os_version", getOsVersion());
jObj.putOpt("android_os_api_level", getAndroidSDKVersion());
jObj.putOpt("android_device", getDeviceName());
jObj.putOpt("screen_resolution", getDisplayWidth() + "x" + getDisplayHeight());
com.huawei.hms.ads.identifier.AdvertisingIdClient.Info info = com.huawei.hms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(mContext);
jObj.putOpt("advertising_id", info != null ? info.getId() : "");
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
//jObj.putOpt("opt_out_of_interest_based_ads_enabled", info != null ?
//info.isLimitAdTrackingEnabled() : "");
} catch (JSONException | IOException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Device Info JSON", e);
WarpUtils.log("*************************************************");
}
final ExecutorService executorDeviceInfo = Executors.newFixedThreadPool(1);
executorDeviceInfo.submit(() -> {
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) {
//Google Play Services are available
try {
jObj.putOpt("platform", "android");
jObj.putOpt("vendor", "google");
jObj.putOpt("development", isInDevelopmentMode());
jObj.putOpt("carrier_name", getCarrierName());
jObj.putOpt("registration_gcm", getRegistrationGCM());
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("android_os_version", getOsVersion());
jObj.putOpt("android_os_api_level", getAndroidSDKVersion());
jObj.putOpt("android_device", getDeviceName());
jObj.putOpt("screen_resolution", getDisplayWidth() + "x" + getDisplayHeight());
GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext);
jObj.putOpt("advertising_id", adInfo != null ? adInfo.getId() : "");
jObj.putOpt("opt_out_of_interest_based_ads_enabled", adInfo != null ?
adInfo.isLimitAdTrackingEnabled() : "");
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
} catch (JSONException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Device Info JSON", e);
WarpUtils.log("*************************************************");
}
} else {
//Google Play Services are not available, or not updated
try {
jObj.putOpt("platform", "android");
jObj.putOpt("vendor", "huawei");
jObj.putOpt("development", isInDevelopmentMode());
jObj.putOpt("carrier_name", getCarrierName());
jObj.putOpt("registration_gcm", getRegistrationGCM());
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("android_os_version", getOsVersion());
jObj.putOpt("android_os_api_level", getAndroidSDKVersion());
jObj.putOpt("android_device", getDeviceName());
jObj.putOpt("screen_resolution", getDisplayWidth() + "x" + getDisplayHeight());
com.huawei.hms.ads.identifier.AdvertisingIdClient.Info info = com.huawei.hms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(mContext);
jObj.putOpt("advertising_id", info != null ? info.getId() : "");
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("app_version", getAppVersion());
//jObj.putOpt("opt_out_of_interest_based_ads_enabled", info != null ?
//info.isLimitAdTrackingEnabled() : "");
} catch (JSONException | IOException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Device Info JSON", e);
WarpUtils.log("*************************************************");
}
}
callback.onSuccess(jObj);
Thread.currentThread().interrupt();
}).start();
executorDeviceInfo.shutdownNow();
});
}
public void getRegistrationParams(final SimpleCallbackReceiver<JSONObject> callback) {
JSONObject jObj = new JSONObject();
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
// For GoogleApiAvailability we need to add a meta tag in Manifest
if (isPackageInstalled("com.android.vending", mContext.getPackageManager())) {
//Google Play Services are available
try {
GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext);
jObj.putOpt("advertising_identifier", adInfo != null ? adInfo.getId() : "");
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("platform", "android");
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("vendor", "google");
jObj.putOpt("app_version", getAppVersion());
} catch (JSONException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Device Info JSON", e);
WarpUtils.log("*************************************************");
}
} else {
//Google Play Services are not available, or not updated
try {
com.huawei.hms.ads.identifier.AdvertisingIdClient.Info info = com.huawei.hms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(mContext);
jObj.putOpt("advertising_identifier", info != null ? info.getId() : "");
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("platform", "android");
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("vendor", "huawei");
jObj.putOpt("app_version", getAppVersion());
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Registration Device Info JSON", e);
WarpUtils.log("*************************************************");
}
final ExecutorService executorRegParams = Executors.newFixedThreadPool(1);
executorRegParams.submit(() -> {
// For GoogleApiAvailability we need to add a meta tag in Manifest
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) {
//Google Play Services are available
try {
GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext);
jObj.putOpt("advertising_identifier", adInfo != null ? adInfo.getId() : "");
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("vendor", "google");
jObj.putOpt("app_version", getAppVersion());
} catch (JSONException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Device Info JSON", e);
WarpUtils.log("*************************************************");
}
} else {
//Google Play Services are not available, or not updated
try {
com.huawei.hms.ads.identifier.AdvertisingIdClient.Info info = com.huawei.hms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(mContext);
jObj.putOpt("advertising_identifier", info != null ? info.getId() : "");
jObj.putOpt("absolute_android_device_id", getAndroidDeviceId());
jObj.putOpt("android_device_id", getHardwareId());
jObj.putOpt("android_device_id_new", getUniqueDeviceId());
jObj.putOpt("unique_device_id", getUniqueDeviceId());
jObj.putOpt("platform", "android");
jObj.putOpt("manufacturer", getDeviceManufacturer());
jObj.putOpt("android_phone_model", getDeviceModel());
jObj.putOpt("os_version", getOsVersion());
jObj.putOpt("vendor", "huawei");
jObj.putOpt("app_version", getAppVersion());
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
WarpUtils.log("************* WARPLY Warning ********************");
WarpUtils.log("Problem when creating Registration Device Info JSON", e);
WarpUtils.log("*************************************************");
}
}
callback.onSuccess(jObj);
Thread.currentThread().interrupt();
}).start();
executorRegParams.shutdownNow();
});
}
private String hashToString(int value) {
......@@ -299,7 +307,7 @@ public class WarplyDeviceInfoCollector {
}
public String getAdvertisementId() {
if (isPackageInstalled("com.android.vending", mContext.getPackageManager())) {
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS) {
GoogleAdInfoClient.GoogleAdInfo adInfo = GoogleAdInfoClient.getGoogleAdvertisingInfo(mContext);
return adInfo != null ? adInfo.getId() : "";
} else {
......@@ -409,11 +417,12 @@ public class WarplyDeviceInfoCollector {
}
public boolean isPackageInstalled(String packageName, PackageManager packageManager) {
try {
return packageManager.getApplicationInfo(packageName, 0).enabled;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
// try {
// return packageManager.getApplicationInfo(packageName, 0).enabled;
// } catch (PackageManager.NameNotFoundException e) {
// return false;
// }
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext) == ConnectionResult.SUCCESS;
}
// ===========================================================
......
......@@ -117,7 +117,7 @@ public class WarpView extends WebView {
setFadingEdgeLength(0);
WebSettings settings = getSettings();
settings.setAppCacheEnabled(true);
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
settings.setJavaScriptEnabled(true);
settings.setDatabaseEnabled(true);
settings.setDomStorageEnabled(true);
......