Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Getting the location as Xamarin.Mobile's GetTakePhotoUI

$
0
0

Hi,

I'm using the Xamarin.Mobile GetTakePhotoUI, and I'm just curious how it gets it's full path to store photos in. I am setting it up with this:

takePhotoBtn.Click += (object sender, EventArgs e) => {
    var intent = mediaPicker.GetTakePhotoUI (new StoreCameraMediaOptions {
        Name = String.Format("photo_{0}.jpg", Guid.NewGuid()),
        Directory = "MyPhotos",
    });
    StartActivityForResult (intent, PHOTO_TAKE_CODE);
    // continues in OnActivityResult
};

That stores in this folder like this: /storage/emulated/0/Android/data/com.mynamespace.MyApp/files/Pictures/MyPhotos/photo_0dfe0951-8715-4c73-937f-99b429c0f2c4.jpg

The first part of that "/storage/emulated/0/" can be grabbed with this: Android.OS.Environment.ExternalStorageDirectory

But how can I get the rest of that path (/Android/data/com.mynamespace.MyApp/files/Pictures/)? I could hard code that, but I'm concerned that it will be different on different devices - and I'd really just like to duplicate the whatever Xamarin.Mobile is doing (I couldn't find it in the source code on github). The idea is to store photos that I grab from GetPickPhotoUI in the same location after processing, rather than relying on the persistence of gallery photos.

Suggestions about better options for storing photos with my app (these are not added to the gallery, they are cropped and downsized, and then only used in the app) are very appreciated.

Thanks!

Kevin N.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>