Hey guys, 😀 Guess who is back.. Its meee. With another post. This one is a quick and simple one. It’s about a possible problem you might face or may already have faced if you are a Windows Phone developer working with WP8.1 and Windows Phone 8.1 emulator.
So the problem is that, if you develop and app where you want photos from the phone library to be open by the PhotoChooserTask or for any other purpose and you need to test this out in the new Windows Phone 8.1 Emulator you can’t find any photos in there. There is nothing.. Nada.. now what’s up with that? Stupid I’d say.. But there is one possibility where you open up the camera app in the emulator and snap a few of the random square thingy that appears in the view finder and use that instead. May be that’s good enough for you, but what if you want real images? Colorful ones to test out your apps? You are in a hole right? 😦 Nope 😀 not exactly. While thinking about this after seeing a question on stackoverflow.com I was looking around the emulator and stumbled upon a nice feature 😀
So here is how it’s done. Open up the phone 8.1 emulator and on the toolbox in the right-hand side on the bottom you will see 2 right facing arrows called tools. Click on this. This will open up a windows called “Additional Tools”.
Here you will see a tab called “SD Card” click on it to activate and then create a folder in your HDD and click browse and set the path to it.
Then you have a checkbox right under the path labeled “Sync updated files back to the local folder when the SD card is ejected.”. Select this. What this does is, it will sync any updated file in the phone emulators emulated SD card and put those files in the folder you have just selected. That is exactly what we want. 😀
Then click on the “Insert SD card” button and wait till its done.
You will see a message box appear in the emulator saying that it has detected a new SD card and ask if you want to use it so save your photos and stuff. Click YES. 🙂
Now to check you can go to Settings > Storage Sense and check that you can save your new photos to “SD Card”.. yay .
Now for the trick. Heheeee. Open up the camera app and snap a few photos. Of that ugly square thingy. And its saved in the photo library which is now sending all its new photos to the SD card. Now Click on “Eject SD Card” button in the Additional Tools window and wait till its saved. (Make sure you don’t have the folder you selected as the Destination open in any application even in the Files Explorer in Windows) Now in the emulator a message box will pop up saying that next time do the ejection of the SD card first from the Settings > Storage Sense page. Click close and ignore that. Now you are almost done. 🙂
Next select a few photos that you want to put in to the phone and make sure they are .jpg s. They need to be same as the file type of the pictures taken in case to make sure nothing goes wrong. Now open up the folder you selected as the Local Storage for the Emulator and see that folder structure was created in that folder.
Navigate to Photos > Camera Roll and past in the copied photos. Now you can imagine what im gonna do 😀 oh yeah.. Copy each of the files names of the images taken from the camera app and use it as the file name of the photos you want and replace the originals. Do that and you are done..
Now again in the emulator you need to mount the SD card. So click on “insert SD card” again and then navigate to photos app and see that your photos are now in the phone and ready to use 😀
Guys, it was that simple.. Right? Create an simple app or open an app you already created and test it out Works like a charm 😀 For more info and to see how its done, Take a look at the Screen Cast onn YouTube.
Alighty then…. See you in the next post.. Adios Amigos. 😀