1,046 questions
0
votes
0
answers
17
views
Why does context.getContentResolver().query throws "CursorWindowAllocationException: Could not create CursorWindow...." on some Android TV devices?
Uri uri
...
if (uri.getScheme() != null
&& (uri.getScheme().equals("content") || uri.getScheme().equals("file"))) {
try {
cursor = getActivity()....
3
votes
2
answers
109
views
Android ContentObserver occasionally fails to find call log entry after call ends (5-10% failure rate)
Android ContentObserver occasionally fails to find call log entry after call ends (5-10% failure rate)
I'm using a ContentObserver to monitor call log changes and retrieve call duration immediately ...
1
vote
0
answers
75
views
How to load audio file thumbnails using Coil in android
I'm working on an Android app where I display a list of local audio files. Currently, I'm using ContentResolver.loadThumbnail() to get the thumbnails (album art) for these audio files, but this method ...
0
votes
1
answer
93
views
How to read an image from a MediaStore URI for a file created by my app?
I have an application where I'm writing an image from a temp file/URI to the shared storage ('/storage/emulated/0/Pictures') using ContentResolver:
def addToMediaStore(): Uri? {
val filename = &...
0
votes
0
answers
65
views
How to query Buckets of content resolver with count (efficiently)
I'm trying to query all the buckets in external uri with their count from contentResolver.
I tried two approaches and both have big drawbacks.
Approach 1:
Use contentResolver's query API with bundles ...
1
vote
0
answers
25
views
Change notification sound with .setSound(Uri uri)
In my project i'm trying to use custom sound in notifications.
I write it like this:
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, CHANNEL_ID)
...
1
vote
0
answers
61
views
Android Kotlin uri to InputStream
I'm doing a project to read Excel files from my phone and output the data to the screen.
This is how I try to do it:
private fun readDataExel() {
val file = Uri.parse("content://com....
0
votes
1
answer
44
views
Android open file from download folder without Intent
It is pretty easy to open a file from download folder, if you let user pick it via Intent. You get the uri and use
contentResolver.openInputStream(uri)?.use { inputStream ->
val ...
0
votes
0
answers
35
views
Retrieve file path in Android and iOS using ReactNative
I'm developing a ReactNative project (android & iOS apps) under Expo management. I've already implemented a chat system where I should send and receive PDF file/Videos/Images and where I should ...
2
votes
1
answer
738
views
No persistable permission grants found for UID and Uri
I'm building an app that:
creates an object that has a field for an image
picks an image from a device storage gallery
stores that object into a room database
shows the data with the image from ...
1
vote
2
answers
409
views
How to Fetch List of Photos and Videos from Device Storage in Android Using Kotlin?
I'm developing an Android app in Kotlin, and I need to retrieve a list of photos and videos from the device storage. I’ve read that MediaStore can be used for this purpose, but I’m unsure how to set ...
0
votes
0
answers
100
views
Android. How to save a file in a public directory of external storage correctly?
I want to save file in a public external storage. For this I use the following code:
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
However, starting with Android 10, ...
0
votes
1
answer
266
views
Put our calling- or SMS-app in the "Connected Apps" list contact app
I need our app to be shown as an option in the "Connected Apps" list of the android's default contact app, just like how WhatsApp, Truecaller and Telegram etc. - as shown in the image below.
...
0
votes
1
answer
655
views
ContentResolver.takePersistableUriPermission: SecurityException No persistable permission grants found for UID 10434 and Uri content:/
I have noticed the following exception (Firebase Crashlytics):
Fatal Exception: java.lang.RuntimeException
Failure delivering result ResultInfo{who=null, request=1915322883, result=-1, data=Intent { ...
1
vote
1
answer
307
views
Runtime error on working with flutter on Android Studio
I'm building an app using Flutter which shows world time. I'm using the worldtimeapi for that but I'm running into this same error. I'm getting the output but the runtime error isn't going. How do I ...
1
vote
0
answers
191
views
Calendar Provider - Insert Event Not Working on SDK Version 34 (Android 14)
I trying to add event in the calendar using calendar provider which is working fine on all SDK Versions except SDK Version 34 (android 14).
This is majorly happening on devices (primarily Google Pixel)...
0
votes
1
answer
113
views
Content Provider: when try to access data in contentResolver,cursor object is null in Android 13
I am trying to transfer data between my two apps by using content provider. Under Android 13, content provider transfer data between two apps. But, In Android 13, cursor object is null in content ...
0
votes
1
answer
771
views
ContentResolver.takePersistableUriPermission() has no documented error possible yet evidently can occur
I've had success using
getContentResolver().takePersistableUriPermission(myUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
to allow for access to a document across reboots (previously obtained using ...
0
votes
1
answer
65
views
Are Content Provider Column id's always unique no matter the case?
e.g
MediaStore.Audio.Media._ID.
The reason why Im asking is because Im reading music data and writing them into Room database. I dont want there to be a situation where a song cant be added because ...
2
votes
1
answer
165
views
Event added using content provider isn't saved
I tried adding a calendar event to the Android calendar using this code:
fun insertEvent(event: CalendarEvent): Uri? {
val contentResolver = context.contentResolver
val values = ContentValues()...
0
votes
0
answers
141
views
ContentResolver - can't open inserted file on Android API 29+
Here's my code. It works as expected on API level 28 and below, but not on 29 and higher.
ContentResolver contentResolver = getContentResolver();
ContentValues values = new ContentValues();
if (...
0
votes
0
answers
101
views
ContentResolver.insert() creates audio file of "audio/aac" mime type with .aac extension instead of .m4a
The following codec creates audio file for AAC codec with .aac extension filename - audio.aac instead of audio.m4a:
val contentValues = ContentValues().apply {
put(MediaStore.Audio.Media....
0
votes
0
answers
108
views
On Android 11, after renaming media files on a removable micro-sd card, MediaStore can‘t be updated through the ContentResolver.update() method
On Android 11 (API30) and above, after renaming media files on a removable micro-sd card, MediaStore can‘t be updated through the ContentResolver.update() method. my targetSdkVison is 28.
I am not ...
1
vote
0
answers
116
views
Android call log query giving no such column: verstat (code 1 SQLITE_ERROR)
in the app I developed I recover call logs by a method. In particular I am interested in the date, number, duration and type call. The app has been deployed on approximately 600 devices. On almost all ...
0
votes
0
answers
213
views
Delete FDN (Fixed dialling numbers) with contentResolver
I would like to manipulate the FDN (Fixed Dialing Numbers) list from my application. The insert and query functions work fine, but deleting simply doesn't work. The function returns that the number of ...
0
votes
1
answer
607
views
How to get media list from trash bin in kotlin
"I am developing a photo gallery app for Android 11 and later users, where when a user deletes any photo or video, I move it to a trash folder instead of permanently deleting it.
val ...
0
votes
1
answer
137
views
Duplicate phone numbers for each contacts android
In my application i want to show a list with my contacts and their phone number of each one. So i get the contacts from the ContentProvider and then all the numbers of the phone and then i match them ...
0
votes
0
answers
1k
views
ExoPlaybackException: Source error when trying to play audio file
I'm trying to play any audio file from local storage in my android app (music player). for obtaining audio files I use MediaStore.query to obtain audio file data, and for playing them I want to use ...
0
votes
0
answers
236
views
Open file in Android app based on Uri path
Let me explain...
WHAT THE APP DOES
An app allows the user to select an XML file from phone storage.
The XML is opened through an ACTION_GET_CONTENT (changed that to ACTION_OPEN_DOCUMENT) Intent. ...
0
votes
0
answers
40
views
Saving a user selected file in app-specific folder
In my app, the user selects an image from the gallery (with rememberLauncherForActivityResult()). I can show it on the screen, but if I try to save it to my app-specific folder instead (internal or ...
0
votes
0
answers
49
views
ContentResolver delete ContentUri deletes ambiguous file, why is it behaving this way?
I don't understand why this delete is behaving this way. I am adding a ringtone to a contact with a Uri built with
val fContUri = MediaStore.Audio.Media.getContentUriForPath(file.absolutePath)
...
1
vote
0
answers
129
views
Android FileProvider: Can I view/share file from Downloads /Documents /DCIM Folders?
I have pdf files in Downloads Folder: Environment.DIRECTORY_DOWNLOADS+File.separator+"MyFolder". Listed the files I need in a Recyclerview. I need to view any selected file in any pdfviewer, ...
0
votes
0
answers
71
views
Instantly not able to delete contents from Calendar
`I'm facing an issue with the ListView in an Android app where I'm able to delete an event from the listview using a content resolver. The deletion is reflected instantly in the ListView, but when I ...
0
votes
0
answers
70
views
Android Call logs return zero results
I am trying to get the call records for multi sim for a given period of time last ten minutes for the iccid. When I check the cursor count it always return zero records. Is there something wrong with ...
0
votes
1
answer
302
views
Save android file preserving its mimetype
I am developing an Android app and need to save file to cache directory. I get file through ActivityResultContracts, which returns "content://" uri. Bellow is the function to download (...
1
vote
1
answer
237
views
Android: access SQLite database via Content Provider with multiple users in same application
My requirement is to create a sqlitedb which can be shared with any user who logs into the application. Looks like ContentProvider can be used only to share the db with other applications. Is there ...
2
votes
1
answer
138
views
Accessing SQLite DB in multiuser app in Android
I've a requirement to access database created by a system user from other service via a foreground user. Both services are part of the same application.
Created a system service, which creates a ...
2
votes
1
answer
428
views
How to upload File which app doesn't own and has only Uri with read permission with Retrofit2
Right now when I select some file to upload from my app, for example a photo
private val imageFileFromGalleryPickResult =
registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { ...
0
votes
2
answers
463
views
Get Uri of PDF file saved in android device's document directory
I am downloading a PDF file from the web, and storing it in the documents folder of the android device, using DownloadManager API. For that, I am using the method setDestinationInExternalPublicDir, ...
3
votes
1
answer
650
views
registerForActivityResult(ActivityResultContracts.CaptureVideo()) callback is always false
I provided Uri with contentResolver on version>29
The ActivityResultContracts.takePicture() works well.
I used the Uri to capture video with the following code
private val getVideo =
...
1
vote
0
answers
61
views
Unable to get Contact ID of the updated Contact. ContentObserver for the uri "ContactsContract" cannot capture the contact-ID
When a user changes/updates contact details in the contacts app I need to capture the update in that specific contact and get that specific contact ID to make relevant changes to the contact data ...
0
votes
2
answers
347
views
Android: ContentResolver addStatusChangeListener not working in Jetpack Compose
I'm trying to rewrite my old code in Jetpack Compose, but I have trouble with ContentResolver.addStatusChangeListener which is not firing sync events. I'm using the same business logic (viewmodel, ...
0
votes
1
answer
462
views
Not Able to find Image File in Content Resolver
I'm trying to upload image on server.
Following code is used to get the path of image.
public static String getPath(final Context context, final Uri uri) {
// DocumentProvider
try {
if ...
0
votes
1
answer
1k
views
Access Images In External Storage Created By My App
I need a method to access the images stored in external storage by my app.
I want to access those images without requesting READ_EXTERNAL_STORAGE or READ_MEDIA_IMAGES from the user
I'm using ...
3
votes
0
answers
566
views
How do you mock a ContentResolver for Android 33?
I want to make sure that the below method only returns what it is supposed to by writing a test for it.
internal fun getMusicFromMediaStore(contentResolver: ContentResolver): List<MusicFile>
...
1
vote
0
answers
185
views
Android emulator API 31-33 system brightness slider not updating
on the emulator with API versions 31-33, when running this code, and looking at the notifications shade to check the brightness slider, it seems unchanged.
if (Build.VERSION.SDK_INT < Build....
0
votes
1
answer
495
views
Android ContentResolver how to specify the sort order?
I am trying to sort alphabetically mp3 files in correct order but no success.
I tried using different sort order and it doesn't work.
List<Uri> listUriSub = new ArrayList<>();
...
0
votes
0
answers
233
views
Android Insert Intent Calendar Event Not Trigger startActivityForResult or ActivityResultLauncher
I want to add a calendar event with intent. The code below does this successfully.
val startMillis: Long = Calendar.getInstance().run {
set(2012, 0, 19, 7, 30)
timeInMillis
}
val endMillis: ...
0
votes
1
answer
144
views
Gradle version issue in dolphin Andriod studio version
After the updating the new version of Android Studio ,I am facing the error message in our Android Studio.
**> Unsupported Gradle.
> The project uses Gradle version which is incompatible with ...
0
votes
1
answer
123
views
Getting photo dimension of locally stored photo
I'd like to know photos width and height before loading a bitmap. I'm using latest approach of ContentResolver to query locally stored photos.
contentResolver.query(
collection,
...