Last active
June 4, 2016 13:01
-
-
Save marchbold/ecf00b6352e8193aa866 to your computer and use it in GitHub Desktop.
Requesting access to the user's contact list using the Contacts ANE
This file contains hidden or 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
Contacts.init( APPLICATION_KEY ); | |
Contacts.service.addEventListener( AuthorisationEvent.CHANGED, contacts_authorisationChangedHandler ); | |
switch (Contacts.service.authorisationStatus()) | |
{ | |
case AuthorisationStatus.SHOULD_EXPLAIN: | |
case AuthorisationStatus.NOT_DETERMINED: | |
// REQUEST ACCESS: This will display the permission dialog | |
Contacts.service.requestAccess(); | |
return; | |
case AuthorisationStatus.DENIED: | |
case AuthorisationStatus.UNKNOWN: | |
case AuthorisationStatus.RESTRICTED: | |
// ACCESS DENIED: You should inform your user appropriately | |
return; | |
case AuthorisationStatus.AUTHORISED: | |
// AUTHORISED: Contacts will be available | |
break; | |
} | |
... | |
private function contacts_authorisationChangedHandler( event:AuthorisationEvent ):void | |
{ | |
// Check event.status | |
} | |
// com.distriqt.Contacts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment