mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Android: Try to redirect from http to https on newer devices
This commit is contained in:
parent
8ee7028104
commit
ced493388f
@ -913,6 +913,11 @@ public class MainActivity extends Activity
|
|||||||
static byte[] readCache = new byte[8192];
|
static byte[] readCache = new byte[8192];
|
||||||
|
|
||||||
public static int httpInit(String url, String method) {
|
public static int httpInit(String url, String method) {
|
||||||
|
// newer android versions block cleartext traffic by default
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= 26) {
|
||||||
|
url = url.replace("http://", "https://");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conn = (HttpURLConnection)new URL(url).openConnection();
|
conn = (HttpURLConnection)new URL(url).openConnection();
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user