Created
June 13, 2016 14:55
-
-
Save cbaggers/da1c049c80952f0932aa2a4d714743f9 to your computer and use it in GitHub Desktop.
Example of permissions api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Packages": [ | |
"Fuse", | |
"FuseJS", | |
"Uno.Permissions" | |
], | |
"Includes": [ | |
"*" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<App> | |
<DockPanel> | |
<TopFrameBackground DockPanel.Dock="Top" /> | |
<Button Clicked="TakePicture" Text="TakePicture" Height="100" /> | |
<BottomBarBackground DockPanel.Dock="Bottom" /> | |
</DockPanel> | |
</App> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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