Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/myflashlab/PermissionCheck-ANE
Check and request for permissions in your Adobe Air app
https://github.com/myflashlab/PermissionCheck-ANE
Last synced: about 2 months ago
JSON representation
Check and request for permissions in your Adobe Air app
- Host: GitHub
- URL: https://github.com/myflashlab/PermissionCheck-ANE
- Owner: myflashlab
- Archived: true
- Created: 2016-06-07T12:54:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-06T11:12:27.000Z (over 4 years ago)
- Last Synced: 2024-08-03T05:03:15.593Z (5 months ago)
- Language: ActionScript
- Size: 4.79 MB
- Stars: 12
- Watchers: 8
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
- awesome-actionscript-sorted - PermissionCheck-ANE - Check and request for permissions in your Adobe Air app (Native Extension / System ANE)
README
# Permission Check ANE for iOS/Android
This AIR Native Extensions lets you check the permission status of different iOS/Android sources like the camera, photos, contacts, calendar, reminders, location, mic and etc. This ANE also allows you to request for a permission if its status is still unknown (on iOS) or denied (on Android).**NOTE:** If you need other permissions, just leave us a message in the issues section and we will gladly add it to the currently supported permissions.
Here are the list of permissions that this ANE currently supports:
**on iOS:**
* CAMERA
* MIC
* CONTACTS
* CALENDAR
* PHOTOS
* REMINDER
* LOCATION (when in app)
* LOCATION (always)**on Android:**
* CAMERA
* MIC
* CONTACTS
* CALENDAR
* PHONE
* STORAGE
* LOCATION
* SENSORS
* SMS[find the latest **asdoc** for this ANE here.](http://myflashlab.github.io/asdoc/com/myflashlab/air/extensions/nativePermissions/package-detail.html)
# Air Usage
```actionscript
import com.myflashlab.air.extensions.nativePermissions.PermissionCheck;// initialize the ane
PermissionCheck.init();// check for a permission state
var permissionState:int = PermissionCheck.check(PermissionCheck.SOURCE_CAMERA);
// PermissionCheck.SOURCE_CAMERA > both platforms
// PermissionCheck.SOURCE_MIC > both platforms
// PermissionCheck.SOURCE_CONTACTS > both platforms
// PermissionCheck.SOURCE_CALENDAR > both platforms
// PermissionCheck.SOURCE_PHOTOS > iOS ONLY
// PermissionCheck.SOURCE_REMINDER > iOS ONLY
// PermissionCheck.SOURCE_LOCATION_WHEN_IN_USE > iOS ONLY
// PermissionCheck.SOURCE_LOCATION_ALWAYS > iOS ONLY
// PermissionCheck.SOURCE_PHONE > Android ONLY
// PermissionCheck.SOURCE_STORAGE > Android ONLY
// PermissionCheck.SOURCE_LOCATION > Android ONLY
// PermissionCheck.SOURCE_SENSORS > Android ONLY
// PermissionCheck.SOURCE_SMS > Android ONLY/*
The returned state will be one of these values:
PermissionCheck.PERMISSION_UNKNOWN > iOS ONLY when it's the first time that you are calling the feature.
PermissionCheck.PERMISSION_DENIED
PermissionCheck.PERMISSION_GRANTED
*/// if the state is PERMISSION_UNKNOWN on iOS or PERMISSION_DENIED on Android, you can request for a permission like this:
PermissionCheck.request(PermissionCheck.SOURCE_CAMERA, onRequestResult);private function onRequestResult($obj:Object):void
{
trace("permission for " + $obj.source + ": " + $obj.state);
}/*
ON iOS:
When you request for a permission which is currently in UNKNOWN
state, a dialog window will open and asks for user's permission
if the app should have access to the requested resource. No matter
what the decision of the user would be, you will never again be
able to request for that permission again! Don't ask me why, it's
how iOS works :)
So, What would happen if a user has denied a request but later she
changes her mind? well, in that case, you should take the user to
the app's settings menu using ```PermissionCheck.openSettings();```
where user can see the list of permissions she has granted to your
app.
NOTICE: as soon as a user changes the state of a permission in the
settings menu, your app will be shut down by OS.
--------------------------------------------------------------------
ON ANDROID:
As long as a feature permission is in DENIED state, you can request
for user's permission and a dialog will open by the ANE. Even the
first time that you are asking for a permission, the state is DENIED.
Optionally, you can call ```PermissionCheck.openSettings();``` to open
the app settings window so users can see the list of features that
your app has requested permissions for.
*/
```# Air .xml manifest
```xml
MinimumOSVersion
10.0
NSCameraUsageDescription
My description about why I need this feature in my app
NSMicrophoneUsageDescription
My description about why I need this feature in my app
NSContactsUsageDescription
My description about why I need this feature in my app
NSCalendarsUsageDescription
My description about why I need this feature in my app
NSPhotoLibraryUsageDescription
My description about why I need this feature in my app
NSRemindersUsageDescription
My description about why I need this feature in my app
NSLocationWhenInUseUsageDescription
My description about why I need this feature in my app
NSLocationAlwaysUsageDescription
My description about why I need this feature in my app
NSLocationAlwaysAndWhenInUseUsageDescription
My description about why I need this feature in my app
NSMotionUsageDescription
My description about why I need this feature in my app
com.myflashlab.air.extensions.permissionCheck
com.myflashlab.air.extensions.dependency.overrideAir
com.myflashlab.air.extensions.dependency.androidx.core
-->
```# Requirements
1. iOS 10.0+
2. AirSDK 33+
3. Android 19+
4. The following dependencies
* ```com.myflashlab.air.extensions.dependency.overrideAir```
* ```com.myflashlab.air.extensions.dependency.androidx.core```# Commercial Version
https://www.myflashlabs.com/product/native-access-permission-check-settings-menu-air-native-extension/[![Permission Check ANE](https://www.myflashlabs.com/wp-content/uploads/2016/06/product_adobe-air-ane-permission-check-2018-595x738.jpg)](https://www.myflashlabs.com/product/native-access-permission-check-settings-menu-air-native-extension/)
# Tutorials
[How to embed ANEs into **FlashBuilder**, **FlashCC** and **FlashDevelop**](https://www.youtube.com/watch?v=Oubsb_3F3ec&list=PL_mmSjScdnxnSDTMYb1iDX4LemhIJrt1O)
[Understanding How Permissions Work before the release of AIR 24](http://www.myflashlabs.com/understanding-android-ios-permissions-in-adobe-air-apps/)
[How to work with Permissions after the release of AIR SDK 24](http://www.myflashlabs.com/adobe-air-app-permissions-android-ios/)# Premium Support #
[![Premium Support package](https://www.myflashlabs.com/wp-content/uploads/2016/06/professional-support.jpg)](https://www.myflashlabs.com/product/myflashlabs-support/)
If you are an [active MyFlashLabs club member](https://www.myflashlabs.com/product/myflashlabs-club-membership/), you will have access to our private and secure support ticket system for all our ANEs. Even if you are not a member, you can still receive premium help if you purchase the [premium support package](https://www.myflashlabs.com/product/myflashlabs-support/).