Got null IMediaPicker

Dimtim.1517Dimtim.1517 USMember ✭✭

In my PCL project I need to have access to media folder, so I am trying to do this:

_mediaPicker = DependencyService.Get<IMediaPicker>();

but unfortunately I got null here, both on emulator and on real device.

I've tried to add following code at Android app OnCreate:

var container = new SimpleContainer();
container.Register<IDevice>(t => AndroidDevice.CurrentDevice);
container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
container.Register<INetwork>(t => t.Resolve<IDevice>().Network);
container.Register<IMediaPicker>(t => t.Resolve<MediaPicker>());

But result is the same. What am I doing wrong?

Sign In or Register to comment.