Forum Xamarin Xamarin.Android

this.ContentResolver.Insert() not working

I'm using Xamarin Android and can't get, for the life of me, something to work.
I'm trying to change the default ringtone sound but it won't work.
I found code to do this with the RingtoneManager class, so I think that part is fine.
I think where I'm having trouble is with the Uri's:

var uri = Media.GetContentUriForPath(soundFilePath);
var newUri = this.ContentResolver.Insert(uri, values);

I'm printing (Log.Info) these values for debugging:
uri prints fine, but I get a null exception when printing newUri.Path,
Log.Info(TAG, "newUri: " + newUri.Path);
And get a null string when printing just newUri
Log.Info(TAG, "newUri: " + newUri);

This is all in th MainActivity.


Sign In or Register to comment.