sudo yum update && sudo yum upgrade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void initWebView() { | |
mWebView.setWebViewClient(new WebViewClientImpl()); | |
mWebView.setWebChromeClient(new WebChromeClient()); | |
mWebView.getSettings().setUseWideViewPort(true); | |
mWebView.getSettings().setLoadWithOverviewMode(true); | |
mWebView.getSettings().setSupportZoom(true); | |
mWebView.getSettings().setBuiltInZoomControls(true); | |
mWebView.loadUrl(mUrl); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
yum --enablerepo=extras install epel-release | |
yum -y install patch dkms kernel-devel perl | |
yum update | |
#Required for kernel num 5: | |
yum --enablerepo=elrepo-kernel -y install kernel-ml-devel | |
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Based on: https://www.linuxsecrets.com/1631-complete-guide-installing-openresty-a-nginx-full-fledged-web-server-on-redhat-scientific-linux-debian | |
#Get openSSL version that you want to compile with | |
cd /usr/local/src | |
wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz | |
tar zxvf openssl-1.1.1f.tar.gz | |
#Get Open resty version | |
cd /tmp | |
wget https://openresty.org/download/openresty-1.17.8.2.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getDefaultUserAgentString(Context context) { | |
if (Build.VERSION.SDK_INT >= 17) { | |
return NewApiWrapper.getDefaultUserAgent(context); | |
} | |
try { | |
Constructor<WebSettings> constructor = WebSettings.class.getDeclaredConstructor(Context.class, WebView.class); | |
constructor.setAccessible(true); | |
try { | |
WebSettings settings = constructor.newInstance(context, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//callback for user id: | |
//Either takes the user's advertiserId or creates a unique ID, if | |
AsyncTask<Void, Void, String> task = new AsyncTask<Void, Void, String>() { | |
@Override | |
protected String doInBackground(Void... params) { | |
try { | |
AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(YourApplicationClass.this); | |
if (!adInfo.isLimitAdTrackingEnabled()) {//if user hasn't opt-out | |
return adInfo.getId(); | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get ISO 3166-1 alpha-2 country code for this device (or null if not available) | |
* @param context Context reference to get the TelephonyManager instance from | |
* @return country code or null | |
*/ | |
public String getUserCountry(Context context) { | |
try { | |
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); | |
final String simCountry = tm.getSimCountryIso(); | |
if (simCountry != null && simCountry.length() == 2) { // SIM country code is available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-keep public class * extends android.app.Activity | |
-keep public class * extends android.app.Application | |
-keep public class * extends android.app.Service | |
-keep public class * extends android.content.BroadcastReceiver | |
-keep public class * extends android.content.ContentProvider | |
-keep public class * extends android.app.backup.BackupAgentHelper | |
-keep public class * extends android.preference.Preference | |
-keep public class com.android.vending.licensing.ILicensingService | |
-keep public class io.mobitech.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GlideApp.with(context.getApplicationContext()).load(url).fallback(R.drawable.loading) | |
.into((BaseTarget) new BaseTarget<BitmapDrawable>() { | |
@Override | |
public void onResourceReady(@NonNull BitmapDrawable resource, @Nullable Transition<? super BitmapDrawable> transition) { | |
showNotification(context, newsArticle, ((BitmapDrawable) resource).getBitmap()); | |
} | |
@Override | |
public void getSize(@NonNull SizeReadyCallback cb) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void httpGetWithRedirectSupport(final Context context, String url){ | |
Volley.newRequestQueue(context).add(new StringRequest(url, new Response.Listener<String>() { | |
@Override | |
public void onResponse(String s) { | |
// Do nothing | |
} | |
}, new Response.ErrorListener() { | |
@Override | |
public void onErrorResponse(VolleyError volleyError) { | |
if (volleyError.networkResponse != null && (volleyError.networkResponse.statusCode == 302 || volleyError.networkResponse.statusCode == 301)) { |
NewerOlder