The AppStudio Framework (AppFramework) provides QML components used when creating apps in AppStudio for ArcGIS. The AppFramework library of components is unique in that it has features and capabilities that are neither natively provided by the underlying Qt framework nor the ArcGIS Runtime, but are necessary and commonly used for developing apps. We are excited to share new features and enhancements added specifically to AppFramework in the recent AppStudio 4.0 release.
Enhancements
- NetworkRequest component can now return binary data in memory (useful for downloading and manipulating image data and/or downloading a file in parts).
- File component now supports writing of binary data (useful for downloading files in chunks, e.g. download managers and P2P sharing applications).
- The Clipboard component’s share method now lets you preview and share files as an image, video, audio, document, etc. When a file URL is copied to the clipboard you can preview and share the file via AppFramework.clipboard.share().
Permission & Permission Dialog [BETA]
A. Requesting Permission
If your app needs permission to access system-wide capabilities such as Location, Storage, Bluetooth, etc., then the app needs to request & grant the appropriate permission in order to function. The PermissionDialog component provides an interface to request permission at runtime.
The snippet below demonstrates how to request permission for the device’s location. By setting the property openSettingsWhenDenied to true, the app opens application settings when permission is denied.
B. Check for Permission
If your app needs permission to access a capability, you must check whether the app has that permission every single time before you perform the operation. The Permission singleton provides a method, checkPermission(), which lets you quickly determine the status of the permission.
For example, this snippet lets you determine the status of the Location permission.
Permission.checkPermission(Permission.PermissionTypeLocationWhenInUse)
The method returns an enumerator value determining the state as follows:
-
-
-
-
- PermissionResultGranted
- PermissionResultDenied
- PermissionResultRestricted
- PermissionResultUnknown
-
-
-
C. Service Availability
If your app needs to check the real-time status of a service provided by a device such as Bluetooth or location, the Permission singleton provides a method, serviceStatus(), which lets you determine the status.
For example, this snippet lets you determine the status of the Location service.
Permission.serviceStatus(Permission.LocationService)
The method returns an enumerator value determining the state as follows:
-
-
-
-
- ServiceStatusUnknown
- ServiceStatusReset
- ServiceStatusUnsupported
- ServiceStatusUnauthorized
- ServiceStatusPoweredOff
- ServiceStatusPoweredOn
-
-
-
Camera Dialog [BETA]
The CameraDialog is a lightweight component that provides direct access to the system camera controls with the best available resolution supported by the device. It comes with two modes i.e., CameraCaptureModeStillImage and CameraCaptureModeVideo, which lets you capture an image or video respectively. After the capture is complete, you can playback & review before saving.
The CameraDialog is a separate component and it works in addition to the QML Camera component. The new Camera Dialog provided in ArcGIS.AppFramework.Multimedia gives you a solution to easily add photo and video capture to your custom app.
Ability to change languages in runtime
An app will always load the appropriate translation file to match the default system locale. An alternative for testing is a command-line parameter –locale, which will override the system locale, i.e. appending —locale fr to the command line will launch the app in French.
With AppStudio 4.0, we have made some changes in the AppFramework for better changing of the app locale.
- AppFramework.defaultLocale – read or write the current default locale (this impacts not only text shown, but also date/time pickers, thousands of separators, and decimal separators)
- AppFramework.loadTranslator – change the translations for the currently loaded app. Notice that AppStudio Player version 4.0 is taking advantage of this new method, and has a setting to change the Player language. You can download the source code of the Player and see how our team is using this method.
We encourage you to try these new features and enhancements added to the AppFramework.
- Please let us know your feedback and suggestions by emailing appstudiofeedback@esri.com.
- New to AppStudio? Check out this website to learn more about what AppStudio for ArcGIS can do to you and your organization.
- Become an AppStudio for ArcGIS developer! Watch this video on how to sign up for a free trial.
- Follow us on Twitter @AppStudioArcGIS to keep up-to-date on the latest information and let us know about your creations built using AppStudio to be featured in the AppStudio Showcase.
- The AppStudio team periodically hosts workshops and webinars; please sign up for the AppStudio newsletter if you are interested in information regarding AppStudio events.
Commenting is not enabled for this article.