android-10.0

Android Q: Get image from gallery and process it

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 03:53:19
问题 I know it seems like a very basic question, but it's specifically for Android Q. I just want to get an image from Gallery and compress it and send to the server. But because of the Android Q's Scoped Storage, it's harder than I thought. I'll first explain what I did with code: First I send out the intent to pick the image. fun openGallery(fragment: Fragment){ val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) intent.type = "*/*" val mimeTypes = arrayOf(

Xamarin Android 10 Install APK - No Activity found to handle Intent

℡╲_俬逩灬. 提交于 2019-12-23 10:13:48
问题 I want to install a 3rd party app from the filesystem from my xamarin android app. The code I used successfully before Android 10 was pretty straightforward and easy. Intent intent = new Intent(Intent.ActionView); Uri data = Uri.FromFile(file); intent.SetDataAndType(data, "application/vnd.android.package-archive"); context.StartActivity(intent); This code does not work on Android 10 because of ACTION_VIEW and ACTION_INSTALL_PACKAGE were deprecated in Android 10. Looks like we now need to use

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

女生的网名这么多〃 提交于 2019-12-22 05:52:07
问题 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

Android Q, programmatically connect to different WiFi AP for internet

醉酒当歌 提交于 2019-12-19 02:49:06
问题 As in Android Q, several WiFi APIs are restricted. I am trying to use alternate APIs to connect to different Wifi AP for internet. Below is my code : WifiNetworkSpecifier.Builder builder = new WifiNetworkSpecifier.Builder(); builder.setSsid("wifi-ap-ssid"); builder.setWpa2Passphrase("wifi-ap-password"); WifiNetworkSpecifier wifiNetworkSpecifier = builder.build(); NetworkRequest.Builder networkRequestBuilder1 = new NetworkRequest.Builder(); networkRequestBuilder1.addTransportType

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

我怕爱的太早我们不能终老 提交于 2019-12-18 14:19:26
问题 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

“Unknown bits set in runtime_flags: 0x8000” warning in Logcat on Android Q emulator

跟風遠走 提交于 2019-12-18 10:46:04
问题 I'm getting this warning as the first line from my app in logcat, and I have no idea what it refers to and how I should go about fixing it. Google doesn't offer much info on this (in fact, none at all). Please advise. What kind of flags might this be about? Is there a way to find out what the specified bit might refer to (or, perhaps, has been referring to on older Android versions)? There is no such line in the log on Android 9 or earlier versions. 回答1: I searched and I have some suggestion

How to open activity (incoming voip call) in Android 10

蓝咒 提交于 2019-12-18 09:14:44
问题 In Android 10 there apply new restrictions for apps. We can no longer start an activity from background. While this may be fine for the majority of apps, it's a killing blow for voip-apps that need to show an incoming call after a push notification arrived. According to this https://developer.android.com/guide/components/activities/background-starts there is a list of conditions that can be met to still allow opening an activity, but tbh I do not understand that fully (non-english-native here

How to read or write file as getExternalStorageDirectory is deprecated in API 29?

帅比萌擦擦* 提交于 2019-12-17 21:04:16
问题 I am new in android development and i am facing some problem to read getExternalStorageDirectory in java, I have read https://developer.android.com/reference/android/os/Environment but can't understand, can someone help me with example code in java. 回答1: From the docs you can see: getExternalStoragePublicDirectory(String type) This method was deprecated in API level 29. To improve user privacy, direct access to shared/external storage devices is deprecated. When an app targets Build.VERSION

For the Intent Chooser, is it possible to set which sharing items to show, and in which order?

时光毁灭记忆、已成空白 提交于 2019-12-13 13:29:36
问题 Background Before Android Q, it was always possible to set which items to show on the sharing dialog, and in which order. I even wrote about it here. For example, if you wanted to prioritize some apps over others, you could use: fun getChooserIntent(context: Context, intent: Intent, chooserTitle: String?, vararg preferredOrderOfApps: String): Intent? { val resolveInfos = context.packageManager.queryIntentActivities(intent, 0) if (resolveInfos.isNullOrEmpty()) return null val

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

浪子不回头ぞ 提交于 2019-12-13 11:58:04
问题 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. 回答1: This happens because of an issue with zipalign, see - https://issuetracker.google.com/issues/37045367. You need to set extractNativeLibs in