Obtain Access Into the Camera Roll Windows Phone 8 - c#

I am having an issue getting into the camera roll folder for Windows Phone 8. Unfortunately due to the project being a MonoGame Project, the MediaLibrary object is not implemented and thus does not work. I am left with having to directly tap into the camera roll folder directly, through I am getting an
Access Denied
Error as a result. The idea is that if I know the location of the file in the future, I can display it in certain parts of my app after the user has taken a photo using the app. The code is as follows:
StorageFile folder = await StorageFile.GetFileFromPathAsync("Pictures\\Camera Roll\\WP_20130227_001.jpg");
I have also checked off:
ID_MEDIALIB_PHOTO
and am still getting the error.
Any help is greatly appreciated!

Try using the photochoosertask..
PhotoChooserTask selectphoto = new PhotoChooserTask();
selectphoto.Completed += new EventHandler<PhotoResult>(selectphoto_Completed);
selectphoto.Show();
this might help.

Related

System.UnauthorizedAccessException Why

Hi i have problem with permission(i think). Im trying to download a file from Mega.nz by MegaApiClient and when it trying to do that that problem appears:
"System.UnauthorizedAccessException: Access to the path '/storage/emulated/0/Download' is denied."
so i was trying different ways to do that like changing path folder or just simple create new file and write all content to that new file but nothing works.
of course i have permission added in AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
<usespermissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
var client = new MegaApiClient();
client.LoginAnonymous();
Uri fileLink = new Uri(Link);
INodeInfo node = client.GetNodeFromLink(fileLink);
client.DownloadFile(node, node.Name); //problem occurs here
client.Logout();
I think that you are writing to internal memory not external.
On the new Android you need to make the user accept the permission. So there most be a warning popup to allow write permission, location, etc.
Also you may try this: Android Dev Console support
The problem probably occurs since your device / emulator on which you test your App has API 23 or higher. This means that the manifest permissions are not enough and you need to add runtime permissions asking for writing files.
This link will explain it using xamarin and this is the official documentation.
A runtime permission basically displays the user a dialog which lets him decide whether or not the App is allowed to access for instance the internal storage of the device.
Oh and this article will also help you implementing it.

Lock screen image change

Here is my code:
Uri u = new Uri(#"C:\roomieUser\w3.tif");
Windows.System.UserProfile.LockScreen.RequestSetImageFeedAsync(u);
I am trying to change the lock screen in a Windows forms application. I have managed to use WinRT libraries in Windows forms application and there are two methods to change picture one is written above and other is as below
LockScreen.SetImageFileAsync(); //But it requires IStorageFile passed in method
I have pictures stored in "resources" folder, is there any method to convert/use these pictures as IStorageFile?
File path is correct but when I tries to run it shows an error message that
Element not found. (Exception from HRESULT: 0x80070490)
LockScreen.RequestSetImageFeedAsync is supposed to be called with a Uri pointing to an RSS feed, not an image. This method is deprecated in Windows 10.
You can use StorageFile.GetFileFromApplicationUriAsync to get files from the application's resources folder.

Using the MediaCapture API, StartRecordToStorageFileAsync fails to return and does not raise an error

I'm trying to use this MediaCapture API sample:
https://code.msdn.microsoft.com/windowsapps/Media-Capture-Sample-adf87622
but when I press Start Record to record to a file, this line never returns:
await m_mediaCaptureMgr.StartRecordToStorageFileAsync(recordProfile, m_recordStorageFile);
And no error is thrown. This computer is a Cyberpower PC. The sample DOES work on my other windows 10 computer (a mac mini) though. I thought maybe it was a codec issue but can't find any information on installing codecs so maybe that is not it--not sure. Thank you for any help or information.
Additional Info: Creating a profile like this works:
MediaEncodingProfile recordProfile = null;
recordProfile = MediaEncodingProfile.CreateWmv(Windows.Media.MediaProperties.VideoEncodingQuality.Auto);
But calling CreateMp4 instead of CreateWmv does not work.
My suspicion is that there's something wrong with your particular installation's encoders. If you can upgrade to Windows 10, with Visual Studio 2015 you can develop universal apps. The same code should work without an issue.

Unable to open camera in window 8 store app using c#

I am the beginner on window 8 store app,still i am working on the app in which i have to open camera and capture the image, but when i try to execute following line of code, its throws following exception.
I am using following line of code
Windows.Media.Capture.CameraCaptureUI dialog = new CameraCaptureUI();
And throwing following exception
Requested Windows Runtime type 'Windows.Media.Capture.CameraCaptureUI' is not registered.
Please advise
thanks in advance
Maybe because you are on an emulator? Can you reproduce the error on a real device?

Using CameraCaptureTask to launch the default camera app

Windows Phone 8 gives the ability to change the default camera app with another one downloaded from the store, making this new app the one that's launched when you hit the camera hardware button.
So I was wondering if is there any chance to launch this app using the CameraCaptureTask.
What I'd like to do is something simple like
var camera = new CameraCaptureTask();
camera.Show();
camera.Completed += new EventHandler<PhotoResult>(camera_Completed);
but I want this to work with the default app that the user chose on its device, and not with the basic Microsoft's one.
I've not found anything online, so I'm asking to you guys if I can make what I want.
Sorry, not possible with the current API.

Categories

Resources