android-10.0

How to create a public folder/file in Android 10

坚强是说给别人听的谎言 提交于 2020-01-11 11:50:11
问题 Android Api 29 has big changes regarding files and folders. I have not found a way so far to create a folder in the internal storage that is public visible. Every folder I create can be seen by my app only. I write an app that creates data files that shall be picked up by other apps, for instance the Total Commander to copy them to a destination. Everything worked fine until I activated Api 29. Some of my clients DO use pixel phones and they use Android 10. How can I create a folder and files

File operations in android Q beta

别说谁变了你拦得住时间么 提交于 2020-01-01 17:01:10
问题 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

File operations in android Q beta

风格不统一 提交于 2020-01-01 16:59:39
问题 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

How to get network usage of apps on Android Q?

放肆的年华 提交于 2020-01-01 03:38:06
问题 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 =

How to detect full screen gesture mode in android Q

℡╲_俬逩灬. 提交于 2019-12-31 10:43:13
问题 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... 回答1: 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

How can I ask for external file access permission in Android Q?

这一生的挚爱 提交于 2019-12-31 05:42:38
问题 Heard Android Q introduced a new security feature called “Scoped Storage” which restricts access files in external storage. My problem is I have to save a text document to a user specified location from the App. Is this requires any kind of permission rather than READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE in Q devices? 回答1: My problem is I have to save a text document to a user specified location from the App Use ACTION_CREATE_DOCUMENT to allow the user to specify the location. You can

Intent filter works on emulator but not on device

二次信任 提交于 2019-12-28 07:05:09
问题 I'm creating a custom intent filter which will open my app when I tap a file with a certain file extension ( .myextension in this case.) The intent-filter is below. This currently works perfectly every time I open a .myextension file from my emulator. However, when I try it from my device, it no longer works. On my device, when I tap a .myextension file in the Files browser app, I see Unable to preview file. instead of automatically opening the app. I've tried opening the file from quite a

Can't start activity from BroadcastReceiver on android 10

穿精又带淫゛_ 提交于 2019-12-28 06:39:30
问题 I updated my OS version to android 10 last night, and since then the startActivity function inside the broadcast receiver is doing nothing. This is how I try to start the activity based on the answer of CommonsWare: Intent i = new Intent(context, AlarmNotificationActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { // This is at least android 10... Log.d("Debug", "This is android 10"); // Start the

How to broadcast photo to gallery on Android Q

牧云@^-^@ 提交于 2019-12-25 01:49:43
问题 I use these code to take a photo and broadcast the photo to gallery, it works. I found that my broadcast function use MediaStore.Images.ImageColumns.DATA and Intent.ACTION_MEDIA_SCANNER_SCAN_FILE , and these are deprecated! How can I replace these function without use MediaStore.Images.ImageColumns.DATA and Intent.ACTION_MEDIA_SCANNER_SCAN_FILE . Thank you. // set open camera button. private void setCameraButton() { cameraBtn.setOnClickListener(new View.OnClickListener() { @Override public

AMediaExtractor setDataSource AMEDIA_ERROR_UNSUPPORTED error on Android Q

无人久伴 提交于 2019-12-24 04:54:11
问题 I am working with AMediaCodec and AMediaExtractor , all works fine on all devices(I hope:), but if I check the same code on Android Q (in my case Pixel 2XL) I got such error AMEDIA_ERROR_UNSUPPORTED . What I do bool NativeCodec::createStreamingMediaPlayer(const std::string &filename) { AMediaExtractor *ex = AMediaExtractor_new(); media_status_t err = AMediaExtractor_setDataSource(ex, filename.c_str());; <-- Here media status I got AMEDIA_ERROR_UNSUPPORTED if (err != AMEDIA_OK) { __android_log