Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marchbold/ecf00b6352e8193aa866 to your computer and use it in GitHub Desktop.
Save marchbold/ecf00b6352e8193aa866 to your computer and use it in GitHub Desktop.
Requesting access to the user's contact list using the Contacts ANE
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