android-10.0

Acccess to /proc/net/tcp in Android Q

柔情痞子 提交于 2019-12-06 11:19:45
In my VPN application up until Android-9, it was possible to read the /proc/net/tcp files from apps targeting API level < 28. Access from apps no longer seems to work in Android Q. I'm getting an error /proc/net/tcp: open failed: EACCES (Permission denied) while trying to read the file. In Android-Q privacy change google has addressed Restriction on access to /proc/net filesystem And I think ConnectivityManager.getConnectionOwnerUid() can be used if the apps compileSDK version is 29. But unfortunately at the moment, I can't change my compileSDK version but I updated the targetSDK version to

Is it possible to add a network configuration on Android Q?

我只是一个虾纸丫 提交于 2019-12-05 07:34:22
Background I've noticed that in WifiManager class there is a function called addNetwork , that might be useful if I want to restore or save networks information (network name AKA SSID, together with the password and the type), so that I could also connect to it. The problem I can't find much information about how to do such a thing. I've seen various examples on StackOverflow, and if I target Android API 28 (or below), I indeed succeed to make it add a network and even connect to it. When targeting Android 29 (Android Q), however, it fails to add the network. What I've found Since I'm trying

File operations in android Q beta

时光毁灭记忆、已成空白 提交于 2019-12-04 15:10:41
1)Target set to Android Q with ""android.permission.WRITE_EXTERNAL_STORAGE"" 2) use getExternalStorageDirectory or getExternalStoragePublicDirectory and FileOutputStream(file) saving file throws java.io.FileNotFoundException: /storage/emulated/0/myfolder/mytext.txt: open failed: ENOENT (No such file or directory) 3) use getExternalFilesDir api and saving is success but wont show up even after MediaScannerConnection.scanFile. /storage/emulated/0/Android/data/my.com.ui/files/Download/myfolder/mytext.txt What is best way to copy file from internal memory to SDCARD in android Q and refresh. In

Targeting SDK Android Q results in Failed to finalize session : INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2

怎甘沉沦 提交于 2019-12-04 01:34:50
Once I switch my target api to 'Q' I cannot install the APK on Android Q Emulator. I get error: Failed to finalize session : INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2 Android Studio (v3.3.2) recommends I uninstall apk first. I tried uninstalling apk and I still get the same error. App work if I downgrade target api to 28. This happens because of an issue with zipalign, see - https://issuetracker.google.com/issues/37045367 . You need to set extractNativeLibs in your Application Tag on AndroidManifest.xml <application android:allowBackup="false" android:label="

Crash on Android 10 (InflateException in layout/abc_screen_simple line #17)

╄→гoц情女王★ 提交于 2019-12-03 23:36:08
My application works fine from Android 4.3 until Android 9 Pie, but my application doesn't work on Android 10 (Q API 29) and crashes. This is my logcat - why this is happening? java.lang.RuntimeException: Unable to start activity ComponentInfo{ir.mahdi.circulars/ir.mahdi.circulars.MainActivity}: android.view.InflateException: Binary XML file line #17 in ir.mahdi.circulars:layout/abc_screen_simple: Binary XML file line #17 in ir.mahdi.circulars:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout and this is my mainActivity.xml <?xml version="1.0"

How to get network usage of apps on Android Q?

假如想象 提交于 2019-12-03 08:18:24
Background I know that we can get the network usage (total bandwidth used of mobile&Wifi so far, from some specific time) of a specified app by using something like that (asked in the past, here ) : private final static int[] NETWORKS_TYPES = new int[]{ConnectivityManager.TYPE_WIFI, ConnectivityManager.TYPE_MOBILE}; long rxBytes=0L, txBytes=0L; final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); final String subscriberId = telephonyManager.getSubscriberId(); final ApplicationInfo applicationInfo = context.getPackageManager()

How to detect full screen gesture mode in android Q

走远了吗. 提交于 2019-12-03 01:05:07
In Android Q, users can enable full screen gesture mode. I want to detect whether the device in full screen gesture mode or not. I can't find anything in documentation. How to do it programmatically at run time? Java or kotlin language answer is OK. Any official API or workaround... According to docs, you can get area of gesture space using getSystemGestureInsets() : https://developer.android.com/reference/android/view/WindowInsets.html#getSystemGestureInsets() If it's zero, then it's disabled ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> { if (insets.getSystemGestureInsets()

Is it possible to programatically enable wifi on Android 10 devices?

蓝咒 提交于 2019-12-02 07:53:20
Since setWifiEnabled is deprecated on Android 10, how does one programatically enable wifi on Android 10 devices? Is it not possible to programatically enable wifi at all on Android 10+ (SDK 29) ? No, This is not possible to enable or disable Wi-Fi programmatically from Android-10 API level 29 [ Until google provides an alternative solution ]. For applications targeting Build.VERSION_CODES.Q or above, this API will always return false and will have no effect. If apps are targeting an older SDK ( Build.VERSION_CODES.P or below), they can continue to use this API. There is an issue 128554616

Android Q emulator - Build.VERSION.SDK_INT returns 28

梦想与她 提交于 2019-12-02 02:27:41
问题 Build.VERSION.SDK_INT returns 28 instead of 29 when running on Android Q emulator. Is there anything I am missing? I am trying to add logic specifically for Android Q but I do not know how to determine this version correctly. app.gradle file contains targetSdkVersion = 'Q' compileSdkVersion = 'android-Q' 回答1: Before the API is finalized and officially becomes API 29 (where you'd use compileSdkVersion 29 , etc), you must use BuildCompat.isAtLeastQ(): Checks if the device is running on a pre

Is it possible to programatically enable wifi on Android 10 devices?

北城以北 提交于 2019-12-01 07:28:58
问题 Since setWifiEnabled is deprecated on Android 10, how does one programatically enable wifi on Android 10 devices? Is it not possible to programatically enable wifi at all on Android 10+ (SDK 29) ? 回答1: No, This is not possible to enable or disable Wi-Fi programmatically from Android-10 API level 29 [ Until google provides an alternative solution ]. For applications targeting Build.VERSION_CODES.Q or above, this API will always return false and will have no effect. If apps are targeting an