Skip to content

Instantly share code, notes, and snippets.

@cbaggers
Created June 13, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbaggers/da1c049c80952f0932aa2a4d714743f9 to your computer and use it in GitHub Desktop.
Save cbaggers/da1c049c80952f0932aa2a4d714743f9 to your computer and use it in GitHub Desktop.
Example of permissions api
{
"Packages": [
"Fuse",
"FuseJS",
"Uno.Permissions"
],
"Includes": [
"*"
]
}
<App>
<DockPanel>
<TopFrameBackground DockPanel.Dock="Top" />
<Button Clicked="TakePicture" Text="TakePicture" Height="100" />
<BottomBarBackground DockPanel.Dock="Bottom" />
</DockPanel>
</App>
using Uno;
using Uno.Permissions;
public partial class MainView
{
public void TakePicture(object a1, EventArgs a2)
{
var permissionPromise = Permissions.Request(Permissions.Android.CAMERA);
permissionPromise.Then(OnPermitted, OnRejected);
}
void OnPermitted(PlatformPermission permission)
{
debug_log "Woo, we can take the picture now";
}
void OnRejected(Exception e)
{
debug_log "Damn: " + e.Message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment