You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Filip Maj <fi...@adobe.com> on 2012/06/20 19:32:15 UTC

[Android] MediaScanner branch

Just an FYI for the Android folks on the list.

https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=s
hortlog;h=refs/heads/mediascanner


I pushed this branch up to the repo as I am working on the
"saveToPhotoAlbum" option for the camera API. Allows the user to specify
if pictures taken should show up in the Gallery application on the phone.

Some phones (Galaxy Nexus, my theory is in general ICS phones) don't show
taken pictures in the Gallery immediately after taking them, if the
picture is saved to external memory. If you reboot the device or
mount/unmount the SD card, it shows up.

The above branch manually triggers Android's MediaScanner service so that
it shows up in the Gallery immediately.

Next I will work on _hiding_ taken pictures from the Gallery.


Re: [Android] MediaScanner branch

Posted by Filip Maj <fi...@adobe.com>.
Merged it after looking over your changes. Tested out all the different
scenarios (compression vs. no compression & saveToPhotoAlbum true vs.
false). Works good.

woot

On 6/21/12 12:30 PM, "Simon MacDonald" <si...@gmail.com> wrote:

>No problem, if you need help with the merge let me know as it will be
>my latest changes that you'll have conflicts with.
>
>Simon Mac Donald
>http://hi.im/simonmacdonald
>
>
>On Thu, Jun 21, 2012 at 3:09 PM, Filip Maj <fi...@adobe.com> wrote:
>> Hey Simon,
>>
>> Thanks for the quick call today. Your suggestions totally worked out!
>>Exif
>> data is rewritten properly now and we no longer get the 0-byte length
>> files showing up in the gallery.
>>
>> I will merge it in shortly!
>>
>> Cheers!
>>
>> On 6/21/12 10:53 AM, "Simon MacDonald" <si...@gmail.com>
>>wrote:
>>
>>>Hey Fil,
>>>
>>>I want to help out with this and I think I can help simplify what is
>>>going on. Now that I see the way to keep the temp image from being
>>>added to the Gallery automatically we should be able to get rid of the
>>>checkForDuplicateImage() method and depending on the saveToPhotoAlbum
>>>monkey around with where the file ends up.
>>>
>>>See if you can grab me on IM later today.
>>>Simon Mac Donald
>>>http://hi.im/simonmacdonald
>>>
>>>
>>>On Wed, Jun 20, 2012 at 6:36 PM, Filip Maj <fi...@adobe.com> wrote:
>>>>
>>>> Another twist!
>>>>
>>>> So the "blank" file that gets written is _not_ a file that we are
>>>>trying
>>>> to write. It is under the /DCIM/ directory on Android. Additionally,
>>>>it
>>>>is
>>>> a 0-byte file. Sounds like the Camera application is doing some bs..
>>>>Not
>>>> sure if we can do anything about it.
>>>>
>>>> Unless people think this is show-stopper I will merge this in later
>>>>this
>>>> week..
>>>>
>>>> On 6/20/12 2:43 PM, "Filip Maj" <fi...@adobe.com> wrote:
>>>>
>>>> >So I've pushed further updates to the media scanner branch.
>>>> >
>>>> >Works on both ICS and Gingerbread. Two issues though:
>>>> >
>>>> >- pictures NOT saved to the photo album can't have the exif headers
>>>> >re-written to them. For some reason the Android exif helper can't
>>>>get a
>>>> >reference to the file (which is in the app jail).
>>>> >- pictures NOT saved to the photo album leave a empty (blank) image
>>>>in
>>>>the
>>>> >gallery. WtfŠ
>>>> >
>>>> >I tried your approach too, Simon, both report back that it failed to
>>>> >delete the image. That said, the image in the gallery is blank..
>>>> >
>>>> >So, I'm not sure. Is this good enough? In terms of a _visible_ image
>>>>in
>>>> >the gallery, we can now control whether an image is shown in the
>>>>gallery
>>>> >or not. The blank/empty image in the gallery is really weird though.
>>>> >
>>>> >Definitely would like input on this from the group before/if I merge
>>>>it
>>>> >in.
>>>> >
>>>> >
>>>> >
>>>> >On 6/20/12 1:37 PM, "Filip Maj" <fi...@adobe.com> wrote:
>>>> >
>>>> >>I got a bit farther. I save the final scaled image to the jail path
>>>>(I.e.
>>>> >>"/data/data/my.package.name/") but when I remove the
>>>>originally-taken
>>>> >>image returned from the camera app, I still see an entry in the
>>>>gallery
>>>> >>app. Interestingly, the entry is completely black and the gallery
>>>>app
>>>> >>can't load it. Huh.
>>>> >>
>>>> >>That said I've just used the File class to delete it, not the
>>>> >>content-resolver-based delete. I'll try that, thanks Simon!
>>>> >>
>>>> >>Also now dealing with having the exif headers re-written back to the
>>>> >>jail-based image file. Apparently the exif helper class can't
>>>>resolve
>>>> >>absolute paths. Simon do you know if the exif helper class assumes a
>>>> >>content: URI?
>>>> >>
>>>> >>On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com>
>>>>wrote:
>>>> >>
>>>> >>>Hey Fil,
>>>> >>>
>>>> >>>Try doing this:
>>>> >>>
>>>> >>>        *int* result = *this*.cordova
>>>> 
>>>>>>>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
>>>> >>>EXTERNAL_CONTENT_URI*,
>>>> >>>
>>>> >>>            MediaStore.Images.Media.*DATA* + " = ?",
>>>> >>>
>>>> >>>            *new* String[] { filePath });
>>>> >>>
>>>> >>>that should delete the image at filePath from the content store. I
>>>>don't
>>>> >>>think it deletes the file but you should be able to see that after
>>>>a
>>>> >>>quick
>>>> >>>test.
>>>> >>>
>>>> >>>Simon Mac Donald
>>>> >>>http://hi.im/simonmacdonald
>>>> >>>
>>>> >>>
>>>> >>>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
>>>> >>>
>>>> >>>> Just an FYI for the Android folks on the list.
>>>> >>>>
>>>> >>>>
>>>>
>>>>>>>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android
>>>>>>>>.g
>>>>>>>>it
>>>> >>>>;
>>>> >>>>a
>>>> >>>>=s
>>>> >>>> hortlog;h=refs/heads/mediascanner
>>>> >>>>
>>>> >>>>
>>>> >>>> I pushed this branch up to the repo as I am working on the
>>>> >>>> "saveToPhotoAlbum" option for the camera API. Allows the user to
>>>> >>>>specify
>>>> >>>> if pictures taken should show up in the Gallery application on
>>>>the
>>>> >>>>phone.
>>>> >>>>
>>>> >>>> Some phones (Galaxy Nexus, my theory is in general ICS phones)
>>>>don't
>>>> >>>>show
>>>> >>>> taken pictures in the Gallery immediately after taking them, if
>>>>the
>>>> >>>> picture is saved to external memory. If you reboot the device or
>>>> >>>> mount/unmount the SD card, it shows up.
>>>> >>>>
>>>> >>>> The above branch manually triggers Android's MediaScanner service
>>>>so
>>>> >>>>that
>>>> >>>> it shows up in the Gallery immediately.
>>>> >>>>
>>>> >>>> Next I will work on _hiding_ taken pictures from the Gallery.
>>>> >>>>
>>>> >>>>
>>>> >>
>>>> >
>>>>
>>


Re: [Android] MediaScanner branch

Posted by Simon MacDonald <si...@gmail.com>.
No problem, if you need help with the merge let me know as it will be
my latest changes that you'll have conflicts with.

Simon Mac Donald
http://hi.im/simonmacdonald


On Thu, Jun 21, 2012 at 3:09 PM, Filip Maj <fi...@adobe.com> wrote:
> Hey Simon,
>
> Thanks for the quick call today. Your suggestions totally worked out! Exif
> data is rewritten properly now and we no longer get the 0-byte length
> files showing up in the gallery.
>
> I will merge it in shortly!
>
> Cheers!
>
> On 6/21/12 10:53 AM, "Simon MacDonald" <si...@gmail.com> wrote:
>
>>Hey Fil,
>>
>>I want to help out with this and I think I can help simplify what is
>>going on. Now that I see the way to keep the temp image from being
>>added to the Gallery automatically we should be able to get rid of the
>>checkForDuplicateImage() method and depending on the saveToPhotoAlbum
>>monkey around with where the file ends up.
>>
>>See if you can grab me on IM later today.
>>Simon Mac Donald
>>http://hi.im/simonmacdonald
>>
>>
>>On Wed, Jun 20, 2012 at 6:36 PM, Filip Maj <fi...@adobe.com> wrote:
>>>
>>> Another twist!
>>>
>>> So the "blank" file that gets written is _not_ a file that we are trying
>>> to write. It is under the /DCIM/ directory on Android. Additionally, it
>>>is
>>> a 0-byte file. Sounds like the Camera application is doing some bs.. Not
>>> sure if we can do anything about it.
>>>
>>> Unless people think this is show-stopper I will merge this in later this
>>> week..
>>>
>>> On 6/20/12 2:43 PM, "Filip Maj" <fi...@adobe.com> wrote:
>>>
>>> >So I've pushed further updates to the media scanner branch.
>>> >
>>> >Works on both ICS and Gingerbread. Two issues though:
>>> >
>>> >- pictures NOT saved to the photo album can't have the exif headers
>>> >re-written to them. For some reason the Android exif helper can't get a
>>> >reference to the file (which is in the app jail).
>>> >- pictures NOT saved to the photo album leave a empty (blank) image in
>>>the
>>> >gallery. WtfŠ
>>> >
>>> >I tried your approach too, Simon, both report back that it failed to
>>> >delete the image. That said, the image in the gallery is blank..
>>> >
>>> >So, I'm not sure. Is this good enough? In terms of a _visible_ image in
>>> >the gallery, we can now control whether an image is shown in the
>>>gallery
>>> >or not. The blank/empty image in the gallery is really weird though.
>>> >
>>> >Definitely would like input on this from the group before/if I merge it
>>> >in.
>>> >
>>> >
>>> >
>>> >On 6/20/12 1:37 PM, "Filip Maj" <fi...@adobe.com> wrote:
>>> >
>>> >>I got a bit farther. I save the final scaled image to the jail path
>>>(I.e.
>>> >>"/data/data/my.package.name/") but when I remove the originally-taken
>>> >>image returned from the camera app, I still see an entry in the
>>>gallery
>>> >>app. Interestingly, the entry is completely black and the gallery app
>>> >>can't load it. Huh.
>>> >>
>>> >>That said I've just used the File class to delete it, not the
>>> >>content-resolver-based delete. I'll try that, thanks Simon!
>>> >>
>>> >>Also now dealing with having the exif headers re-written back to the
>>> >>jail-based image file. Apparently the exif helper class can't resolve
>>> >>absolute paths. Simon do you know if the exif helper class assumes a
>>> >>content: URI?
>>> >>
>>> >>On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com>
>>>wrote:
>>> >>
>>> >>>Hey Fil,
>>> >>>
>>> >>>Try doing this:
>>> >>>
>>> >>>        *int* result = *this*.cordova
>>> >>>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
>>> >>>EXTERNAL_CONTENT_URI*,
>>> >>>
>>> >>>            MediaStore.Images.Media.*DATA* + " = ?",
>>> >>>
>>> >>>            *new* String[] { filePath });
>>> >>>
>>> >>>that should delete the image at filePath from the content store. I
>>>don't
>>> >>>think it deletes the file but you should be able to see that after a
>>> >>>quick
>>> >>>test.
>>> >>>
>>> >>>Simon Mac Donald
>>> >>>http://hi.im/simonmacdonald
>>> >>>
>>> >>>
>>> >>>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
>>> >>>
>>> >>>> Just an FYI for the Android folks on the list.
>>> >>>>
>>> >>>>
>>>
>>>>>>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.g
>>>>>>>it
>>> >>>>;
>>> >>>>a
>>> >>>>=s
>>> >>>> hortlog;h=refs/heads/mediascanner
>>> >>>>
>>> >>>>
>>> >>>> I pushed this branch up to the repo as I am working on the
>>> >>>> "saveToPhotoAlbum" option for the camera API. Allows the user to
>>> >>>>specify
>>> >>>> if pictures taken should show up in the Gallery application on the
>>> >>>>phone.
>>> >>>>
>>> >>>> Some phones (Galaxy Nexus, my theory is in general ICS phones)
>>>don't
>>> >>>>show
>>> >>>> taken pictures in the Gallery immediately after taking them, if the
>>> >>>> picture is saved to external memory. If you reboot the device or
>>> >>>> mount/unmount the SD card, it shows up.
>>> >>>>
>>> >>>> The above branch manually triggers Android's MediaScanner service
>>>so
>>> >>>>that
>>> >>>> it shows up in the Gallery immediately.
>>> >>>>
>>> >>>> Next I will work on _hiding_ taken pictures from the Gallery.
>>> >>>>
>>> >>>>
>>> >>
>>> >
>>>
>

Re: [Android] MediaScanner branch

Posted by Filip Maj <fi...@adobe.com>.
Hey Simon,

Thanks for the quick call today. Your suggestions totally worked out! Exif
data is rewritten properly now and we no longer get the 0-byte length
files showing up in the gallery.

I will merge it in shortly!

Cheers!

On 6/21/12 10:53 AM, "Simon MacDonald" <si...@gmail.com> wrote:

>Hey Fil,
>
>I want to help out with this and I think I can help simplify what is
>going on. Now that I see the way to keep the temp image from being
>added to the Gallery automatically we should be able to get rid of the
>checkForDuplicateImage() method and depending on the saveToPhotoAlbum
>monkey around with where the file ends up.
>
>See if you can grab me on IM later today.
>Simon Mac Donald
>http://hi.im/simonmacdonald
>
>
>On Wed, Jun 20, 2012 at 6:36 PM, Filip Maj <fi...@adobe.com> wrote:
>>
>> Another twist!
>>
>> So the "blank" file that gets written is _not_ a file that we are trying
>> to write. It is under the /DCIM/ directory on Android. Additionally, it
>>is
>> a 0-byte file. Sounds like the Camera application is doing some bs.. Not
>> sure if we can do anything about it.
>>
>> Unless people think this is show-stopper I will merge this in later this
>> week..
>>
>> On 6/20/12 2:43 PM, "Filip Maj" <fi...@adobe.com> wrote:
>>
>> >So I've pushed further updates to the media scanner branch.
>> >
>> >Works on both ICS and Gingerbread. Two issues though:
>> >
>> >- pictures NOT saved to the photo album can't have the exif headers
>> >re-written to them. For some reason the Android exif helper can't get a
>> >reference to the file (which is in the app jail).
>> >- pictures NOT saved to the photo album leave a empty (blank) image in
>>the
>> >gallery. WtfŠ
>> >
>> >I tried your approach too, Simon, both report back that it failed to
>> >delete the image. That said, the image in the gallery is blank..
>> >
>> >So, I'm not sure. Is this good enough? In terms of a _visible_ image in
>> >the gallery, we can now control whether an image is shown in the
>>gallery
>> >or not. The blank/empty image in the gallery is really weird though.
>> >
>> >Definitely would like input on this from the group before/if I merge it
>> >in.
>> >
>> >
>> >
>> >On 6/20/12 1:37 PM, "Filip Maj" <fi...@adobe.com> wrote:
>> >
>> >>I got a bit farther. I save the final scaled image to the jail path
>>(I.e.
>> >>"/data/data/my.package.name/") but when I remove the originally-taken
>> >>image returned from the camera app, I still see an entry in the
>>gallery
>> >>app. Interestingly, the entry is completely black and the gallery app
>> >>can't load it. Huh.
>> >>
>> >>That said I've just used the File class to delete it, not the
>> >>content-resolver-based delete. I'll try that, thanks Simon!
>> >>
>> >>Also now dealing with having the exif headers re-written back to the
>> >>jail-based image file. Apparently the exif helper class can't resolve
>> >>absolute paths. Simon do you know if the exif helper class assumes a
>> >>content: URI?
>> >>
>> >>On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com>
>>wrote:
>> >>
>> >>>Hey Fil,
>> >>>
>> >>>Try doing this:
>> >>>
>> >>>        *int* result = *this*.cordova
>> >>>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
>> >>>EXTERNAL_CONTENT_URI*,
>> >>>
>> >>>            MediaStore.Images.Media.*DATA* + " = ?",
>> >>>
>> >>>            *new* String[] { filePath });
>> >>>
>> >>>that should delete the image at filePath from the content store. I
>>don't
>> >>>think it deletes the file but you should be able to see that after a
>> >>>quick
>> >>>test.
>> >>>
>> >>>Simon Mac Donald
>> >>>http://hi.im/simonmacdonald
>> >>>
>> >>>
>> >>>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
>> >>>
>> >>>> Just an FYI for the Android folks on the list.
>> >>>>
>> >>>>
>> 
>>>>>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.g
>>>>>>it
>> >>>>;
>> >>>>a
>> >>>>=s
>> >>>> hortlog;h=refs/heads/mediascanner
>> >>>>
>> >>>>
>> >>>> I pushed this branch up to the repo as I am working on the
>> >>>> "saveToPhotoAlbum" option for the camera API. Allows the user to
>> >>>>specify
>> >>>> if pictures taken should show up in the Gallery application on the
>> >>>>phone.
>> >>>>
>> >>>> Some phones (Galaxy Nexus, my theory is in general ICS phones)
>>don't
>> >>>>show
>> >>>> taken pictures in the Gallery immediately after taking them, if the
>> >>>> picture is saved to external memory. If you reboot the device or
>> >>>> mount/unmount the SD card, it shows up.
>> >>>>
>> >>>> The above branch manually triggers Android's MediaScanner service
>>so
>> >>>>that
>> >>>> it shows up in the Gallery immediately.
>> >>>>
>> >>>> Next I will work on _hiding_ taken pictures from the Gallery.
>> >>>>
>> >>>>
>> >>
>> >
>>


Re: [Android] MediaScanner branch

Posted by Simon MacDonald <si...@gmail.com>.
Hey Fil,

I want to help out with this and I think I can help simplify what is
going on. Now that I see the way to keep the temp image from being
added to the Gallery automatically we should be able to get rid of the
checkForDuplicateImage() method and depending on the saveToPhotoAlbum
monkey around with where the file ends up.

See if you can grab me on IM later today.
Simon Mac Donald
http://hi.im/simonmacdonald


On Wed, Jun 20, 2012 at 6:36 PM, Filip Maj <fi...@adobe.com> wrote:
>
> Another twist!
>
> So the "blank" file that gets written is _not_ a file that we are trying
> to write. It is under the /DCIM/ directory on Android. Additionally, it is
> a 0-byte file. Sounds like the Camera application is doing some bs.. Not
> sure if we can do anything about it.
>
> Unless people think this is show-stopper I will merge this in later this
> week..
>
> On 6/20/12 2:43 PM, "Filip Maj" <fi...@adobe.com> wrote:
>
> >So I've pushed further updates to the media scanner branch.
> >
> >Works on both ICS and Gingerbread. Two issues though:
> >
> >- pictures NOT saved to the photo album can't have the exif headers
> >re-written to them. For some reason the Android exif helper can't get a
> >reference to the file (which is in the app jail).
> >- pictures NOT saved to the photo album leave a empty (blank) image in the
> >gallery. WtfŠ
> >
> >I tried your approach too, Simon, both report back that it failed to
> >delete the image. That said, the image in the gallery is blank..
> >
> >So, I'm not sure. Is this good enough? In terms of a _visible_ image in
> >the gallery, we can now control whether an image is shown in the gallery
> >or not. The blank/empty image in the gallery is really weird though.
> >
> >Definitely would like input on this from the group before/if I merge it
> >in.
> >
> >
> >
> >On 6/20/12 1:37 PM, "Filip Maj" <fi...@adobe.com> wrote:
> >
> >>I got a bit farther. I save the final scaled image to the jail path (I.e.
> >>"/data/data/my.package.name/") but when I remove the originally-taken
> >>image returned from the camera app, I still see an entry in the gallery
> >>app. Interestingly, the entry is completely black and the gallery app
> >>can't load it. Huh.
> >>
> >>That said I've just used the File class to delete it, not the
> >>content-resolver-based delete. I'll try that, thanks Simon!
> >>
> >>Also now dealing with having the exif headers re-written back to the
> >>jail-based image file. Apparently the exif helper class can't resolve
> >>absolute paths. Simon do you know if the exif helper class assumes a
> >>content: URI?
> >>
> >>On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com> wrote:
> >>
> >>>Hey Fil,
> >>>
> >>>Try doing this:
> >>>
> >>>        *int* result = *this*.cordova
> >>>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
> >>>EXTERNAL_CONTENT_URI*,
> >>>
> >>>            MediaStore.Images.Media.*DATA* + " = ?",
> >>>
> >>>            *new* String[] { filePath });
> >>>
> >>>that should delete the image at filePath from the content store. I don't
> >>>think it deletes the file but you should be able to see that after a
> >>>quick
> >>>test.
> >>>
> >>>Simon Mac Donald
> >>>http://hi.im/simonmacdonald
> >>>
> >>>
> >>>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
> >>>
> >>>> Just an FYI for the Android folks on the list.
> >>>>
> >>>>
> >>>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git
> >>>>;
> >>>>a
> >>>>=s
> >>>> hortlog;h=refs/heads/mediascanner
> >>>>
> >>>>
> >>>> I pushed this branch up to the repo as I am working on the
> >>>> "saveToPhotoAlbum" option for the camera API. Allows the user to
> >>>>specify
> >>>> if pictures taken should show up in the Gallery application on the
> >>>>phone.
> >>>>
> >>>> Some phones (Galaxy Nexus, my theory is in general ICS phones) don't
> >>>>show
> >>>> taken pictures in the Gallery immediately after taking them, if the
> >>>> picture is saved to external memory. If you reboot the device or
> >>>> mount/unmount the SD card, it shows up.
> >>>>
> >>>> The above branch manually triggers Android's MediaScanner service so
> >>>>that
> >>>> it shows up in the Gallery immediately.
> >>>>
> >>>> Next I will work on _hiding_ taken pictures from the Gallery.
> >>>>
> >>>>
> >>
> >
>

Re: [Android] MediaScanner branch

Posted by Filip Maj <fi...@adobe.com>.
Another twist!

So the "blank" file that gets written is _not_ a file that we are trying
to write. It is under the /DCIM/ directory on Android. Additionally, it is
a 0-byte file. Sounds like the Camera application is doing some bs.. Not
sure if we can do anything about it.

Unless people think this is show-stopper I will merge this in later this
week..

On 6/20/12 2:43 PM, "Filip Maj" <fi...@adobe.com> wrote:

>So I've pushed further updates to the media scanner branch.
>
>Works on both ICS and Gingerbread. Two issues though:
>
>- pictures NOT saved to the photo album can't have the exif headers
>re-written to them. For some reason the Android exif helper can't get a
>reference to the file (which is in the app jail).
>- pictures NOT saved to the photo album leave a empty (blank) image in the
>gallery. WtfŠ
>
>I tried your approach too, Simon, both report back that it failed to
>delete the image. That said, the image in the gallery is blank..
>
>So, I'm not sure. Is this good enough? In terms of a _visible_ image in
>the gallery, we can now control whether an image is shown in the gallery
>or not. The blank/empty image in the gallery is really weird though.
>
>Definitely would like input on this from the group before/if I merge it
>in.
>
>
>
>On 6/20/12 1:37 PM, "Filip Maj" <fi...@adobe.com> wrote:
>
>>I got a bit farther. I save the final scaled image to the jail path (I.e.
>>"/data/data/my.package.name/") but when I remove the originally-taken
>>image returned from the camera app, I still see an entry in the gallery
>>app. Interestingly, the entry is completely black and the gallery app
>>can't load it. Huh.
>>
>>That said I've just used the File class to delete it, not the
>>content-resolver-based delete. I'll try that, thanks Simon!
>>
>>Also now dealing with having the exif headers re-written back to the
>>jail-based image file. Apparently the exif helper class can't resolve
>>absolute paths. Simon do you know if the exif helper class assumes a
>>content: URI?
>>
>>On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com> wrote:
>>
>>>Hey Fil,
>>>
>>>Try doing this:
>>>
>>>        *int* result = *this*.cordova
>>>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
>>>EXTERNAL_CONTENT_URI*,
>>>
>>>            MediaStore.Images.Media.*DATA* + " = ?",
>>>
>>>            *new* String[] { filePath });
>>>
>>>that should delete the image at filePath from the content store. I don't
>>>think it deletes the file but you should be able to see that after a
>>>quick
>>>test.
>>>
>>>Simon Mac Donald
>>>http://hi.im/simonmacdonald
>>>
>>>
>>>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
>>>
>>>> Just an FYI for the Android folks on the list.
>>>>
>>>> 
>>>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git
>>>>;
>>>>a
>>>>=s
>>>> hortlog;h=refs/heads/mediascanner
>>>>
>>>>
>>>> I pushed this branch up to the repo as I am working on the
>>>> "saveToPhotoAlbum" option for the camera API. Allows the user to
>>>>specify
>>>> if pictures taken should show up in the Gallery application on the
>>>>phone.
>>>>
>>>> Some phones (Galaxy Nexus, my theory is in general ICS phones) don't
>>>>show
>>>> taken pictures in the Gallery immediately after taking them, if the
>>>> picture is saved to external memory. If you reboot the device or
>>>> mount/unmount the SD card, it shows up.
>>>>
>>>> The above branch manually triggers Android's MediaScanner service so
>>>>that
>>>> it shows up in the Gallery immediately.
>>>>
>>>> Next I will work on _hiding_ taken pictures from the Gallery.
>>>>
>>>>
>>
>


Re: [Android] MediaScanner branch

Posted by Filip Maj <fi...@adobe.com>.
So I've pushed further updates to the media scanner branch.

Works on both ICS and Gingerbread. Two issues though:

- pictures NOT saved to the photo album can't have the exif headers
re-written to them. For some reason the Android exif helper can't get a
reference to the file (which is in the app jail).
- pictures NOT saved to the photo album leave a empty (blank) image in the
gallery. WtfŠ

I tried your approach too, Simon, both report back that it failed to
delete the image. That said, the image in the gallery is blank..

So, I'm not sure. Is this good enough? In terms of a _visible_ image in
the gallery, we can now control whether an image is shown in the gallery
or not. The blank/empty image in the gallery is really weird though.

Definitely would like input on this from the group before/if I merge it in.



On 6/20/12 1:37 PM, "Filip Maj" <fi...@adobe.com> wrote:

>I got a bit farther. I save the final scaled image to the jail path (I.e.
>"/data/data/my.package.name/") but when I remove the originally-taken
>image returned from the camera app, I still see an entry in the gallery
>app. Interestingly, the entry is completely black and the gallery app
>can't load it. Huh.
>
>That said I've just used the File class to delete it, not the
>content-resolver-based delete. I'll try that, thanks Simon!
>
>Also now dealing with having the exif headers re-written back to the
>jail-based image file. Apparently the exif helper class can't resolve
>absolute paths. Simon do you know if the exif helper class assumes a
>content: URI?
>
>On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com> wrote:
>
>>Hey Fil,
>>
>>Try doing this:
>>
>>        *int* result = *this*.cordova
>>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
>>EXTERNAL_CONTENT_URI*,
>>
>>            MediaStore.Images.Media.*DATA* + " = ?",
>>
>>            *new* String[] { filePath });
>>
>>that should delete the image at filePath from the content store. I don't
>>think it deletes the file but you should be able to see that after a
>>quick
>>test.
>>
>>Simon Mac Donald
>>http://hi.im/simonmacdonald
>>
>>
>>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
>>
>>> Just an FYI for the Android folks on the list.
>>>
>>> 
>>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;
>>>a
>>>=s
>>> hortlog;h=refs/heads/mediascanner
>>>
>>>
>>> I pushed this branch up to the repo as I am working on the
>>> "saveToPhotoAlbum" option for the camera API. Allows the user to
>>>specify
>>> if pictures taken should show up in the Gallery application on the
>>>phone.
>>>
>>> Some phones (Galaxy Nexus, my theory is in general ICS phones) don't
>>>show
>>> taken pictures in the Gallery immediately after taking them, if the
>>> picture is saved to external memory. If you reboot the device or
>>> mount/unmount the SD card, it shows up.
>>>
>>> The above branch manually triggers Android's MediaScanner service so
>>>that
>>> it shows up in the Gallery immediately.
>>>
>>> Next I will work on _hiding_ taken pictures from the Gallery.
>>>
>>>
>


Re: [Android] MediaScanner branch

Posted by Filip Maj <fi...@adobe.com>.
I got a bit farther. I save the final scaled image to the jail path (I.e.
"/data/data/my.package.name/") but when I remove the originally-taken
image returned from the camera app, I still see an entry in the gallery
app. Interestingly, the entry is completely black and the gallery app
can't load it. Huh.

That said I've just used the File class to delete it, not the
content-resolver-based delete. I'll try that, thanks Simon!

Also now dealing with having the exif headers re-written back to the
jail-based image file. Apparently the exif helper class can't resolve
absolute paths. Simon do you know if the exif helper class assumes a
content: URI?

On 6/20/12 11:49 AM, "Simon MacDonald" <si...@gmail.com> wrote:

>Hey Fil,
>
>Try doing this:
>
>        *int* result = *this*.cordova
>.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
>EXTERNAL_CONTENT_URI*,
>
>            MediaStore.Images.Media.*DATA* + " = ?",
>
>            *new* String[] { filePath });
>
>that should delete the image at filePath from the content store. I don't
>think it deletes the file but you should be able to see that after a quick
>test.
>
>Simon Mac Donald
>http://hi.im/simonmacdonald
>
>
>On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:
>
>> Just an FYI for the Android folks on the list.
>>
>> 
>>https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a
>>=s
>> hortlog;h=refs/heads/mediascanner
>>
>>
>> I pushed this branch up to the repo as I am working on the
>> "saveToPhotoAlbum" option for the camera API. Allows the user to specify
>> if pictures taken should show up in the Gallery application on the
>>phone.
>>
>> Some phones (Galaxy Nexus, my theory is in general ICS phones) don't
>>show
>> taken pictures in the Gallery immediately after taking them, if the
>> picture is saved to external memory. If you reboot the device or
>> mount/unmount the SD card, it shows up.
>>
>> The above branch manually triggers Android's MediaScanner service so
>>that
>> it shows up in the Gallery immediately.
>>
>> Next I will work on _hiding_ taken pictures from the Gallery.
>>
>>


Re: [Android] MediaScanner branch

Posted by Simon MacDonald <si...@gmail.com>.
Hey Fil,

Try doing this:

        *int* result = *this*.cordova
.getActivity().getContentResolver().delete(MediaStore.Images.Media.*
EXTERNAL_CONTENT_URI*,

            MediaStore.Images.Media.*DATA* + " = ?",

            *new* String[] { filePath });

that should delete the image at filePath from the content store. I don't
think it deletes the file but you should be able to see that after a quick
test.

Simon Mac Donald
http://hi.im/simonmacdonald


On Wed, Jun 20, 2012 at 1:32 PM, Filip Maj <fi...@adobe.com> wrote:

> Just an FYI for the Android folks on the list.
>
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=s
> hortlog;h=refs/heads/mediascanner
>
>
> I pushed this branch up to the repo as I am working on the
> "saveToPhotoAlbum" option for the camera API. Allows the user to specify
> if pictures taken should show up in the Gallery application on the phone.
>
> Some phones (Galaxy Nexus, my theory is in general ICS phones) don't show
> taken pictures in the Gallery immediately after taking them, if the
> picture is saved to external memory. If you reboot the device or
> mount/unmount the SD card, it shows up.
>
> The above branch manually triggers Android's MediaScanner service so that
> it shows up in the Gallery immediately.
>
> Next I will work on _hiding_ taken pictures from the Gallery.
>
>