Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-04 Thread Eli Hasson
The solution for this issue is to query the Database, instead of insert to it, I posted the full solution with code to this issue in my blog: http://androidwarzone.blogspot.co.il/2013/08/media-play-and-share-to-youtube-breaks.html Eli On Fri, Aug 2, 2013 at 11:20 PM, Eli Hasson

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-04 Thread Kostya Vasilyev
But why would you want to directly insert data like that in the first place? The SDK has a helper class, MediaScannerConnection, which submits a file for scanning, and makes sure it's properly indexed by the system. If you're going to use VIEW_ACTION, you can subclass and wait for the scan to

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-04 Thread Eli Hasson
Hi Kostya, You are correct that its not the best practice, but till now it was the easiest way to get the content URI from a file URL, and was commonly used. Also till 4.3 it worked, so I didn't pay it too much attention. Eli -- -- You received this message because you are subscribed to the

[android-developers] Re: ContentResolver insert return null on 4.3

2013-08-02 Thread Nobu Games
I just had a quick peek at the API level 14 source code and it looks like there are two possible reasons for that problem: 1. The actual ContentProvider the ContentResolver connected to returns null on insert (for whatever reason, that is a mystery) 2. A RemoteException was thrown during the

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-02 Thread Eli Hasson
It always return null on 4.3, and works perfectly on all other versions. On Aug 2, 2013 10:13 PM, Nobu Games dev.nobu.ga...@gmail.com wrote: I just had a quick peek at the API level 14 source code and it looks like there are two possible reasons for that problem: 1. The actual ContentProvider

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-02 Thread Nobu Games
Sorry Eli, I should have read your code more carefully. You're hard-coding file paths in that insert request which is bad practice. You cannot assume that there paths like /sdcard/... on all Android devices. They can be named completely differently depending on device / manufacturer and

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-02 Thread Eli Hasson
Thanks for your answer, I just entered hard coded values there to make the code more clear, this is not the issue. Eli On Aug 2, 2013 10:29 PM, Nobu Games dev.nobu.ga...@gmail.com wrote: Sorry Eli, I should have read your code more carefully. You're hard-coding file paths in that insert

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-02 Thread Nobu Games
Is there anything in log cat related to MediaStore? On Friday, August 2, 2013 2:43:17 PM UTC-5, eli wrote: Thanks for your answer, I just entered hard coded values there to make the code more clear, this is not the issue. Eli On Aug 2, 2013 10:29 PM, Nobu Games dev.nob...@gmail.com

Re: [android-developers] Re: ContentResolver insert return null on 4.3

2013-08-02 Thread Eli Hasson
Yep, Looks like I found the issue: 08-02 23:11:54.524: E/SQLiteDatabase(11214): Error inserting bucket_id=1643208667 media_type=3 title=out.mp4 storage_id=65537 mime_type=video/mp4 date_modified=1375474313 _display_name=out.mp4 date_added=1375474314 parent=1184 _size=325469 format=12299