This seems to work, which is great. For some reason it wasn't being initialized properly inside the virtual machine but it does work on actual devices.