First I want to give an outline of the Meraki Methods Supervisor (SM) utility. Methods Supervisor is Meraki’s endpoint control product. We toughen control for plenty of other platforms, together with iOS, Android, macOS, and Home windows. “Managing” a tool can imply tracking its on-line standing, pushing profiles and apps to it, and/or imposing safety insurance policies, amongst different issues. With Methods Supervisor, this control all occurs via Meraki’s on-line interface referred to as Dashboard. Examples and code snippets discussed on this weblog are extra particular to the Android SM utility.
Migration of packages to any SDK principally contains 2 duties from the developer’s standpoint. One is – how the applying behaves when put in on a tool with an Android model instead of the objective SDK of the app. And secondly, how the app will behave when the objective SDK is modified. Builders want to perceive what new options, or updates of any present function, and its have an effect on at the utility are.
This record makes a speciality of probably the most adjustments impacting builders with Android 14 migration. It additionally covers migration of the Methods Supervisor app to Android 14, and demanding situations encountered all over the migration and trying out.
Font Scaling
In previous variations of Android i.e., 13 Non-linear font scaling used to be supported as much as 130% however in Android 14, it’s supported as much as 200% which is able to have an effect on the UI of the applying. Within the utility if font dimensions are declared the usage of sp (scaled pixel) gadgets there are possibilities of minimum have an effect on at the utility as a result of Android framework would follow those scaling components. On account of nonlinear scaling of font density scaling is probably not correct.
Key issues
- TypedValue.applyDimension() to transform from sp gadgets to pixels.
- TypedValue.deriveDimension() to transform pixels to sp
- LineHeight gadgets will have to be laid out in sp to regulate share along side textual content measurement.
Background Procedure Limitation
Android OS is self enough to regulate the sources successfully by means of improvising efficiency as neatly. One of the crucial tips to succeed in the similar is by means of caching packages within the background and handiest when the gadget wishes reminiscence those packages will likely be got rid of from reminiscence. All packages will have to conform to Google Play coverage and therefore killing of processes of alternative packages are strictly limited in Android 14. Therefore killBackgroundProcessess() can kill handiest the background processes of your personal utility.
Foreground Carrier Varieties
In Android 10, a brand new characteristic used to be offered to specify carrier kind for foreground services and products. When the usage of location knowledge within the foreground carrier it used to be required to specify the kind as “location”. While in Android 11, bringing up carrier kind for utilization of digital camera or microphone in foreground carrier used to be mandated. However in Android 14 or above, all foreground services and products will have to be declared with their carrier varieties.
One of the crucial new carrier varieties have been additionally offered in Android 14 – well being, remoteMessaging, shortService, specialUse and systemExempted. If carrier isn’t related to any of the kinds specified, then it’s endorsed to modify common sense to make use of Workmanager or user-initiated knowledge switch jobs. MissingForegroundServiceTypeException will likely be thrown by means of the gadget in case carrier kind isn’t specified.
Carrier kind permissions want to be declared along side specifying the kind in carrier.
<uses-permission android:identify="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" /> <carrier android:identify=".kiosk.v2.carrier.KioskBreakoutService" android:identify=".kiosk.v2.carrier.KioskBreakoutService" android:foregroundServiceType="systemExempted" android:exported="false" />
Boundaries on Implicit Intent and Pending Intent
Implicit intents are handiest brought to exported parts. This restriction guarantees the applying’s implicit intents aren’t utilized by some other malicious apps. Additionally, all mutable pending intent will have to specify an element or bundle knowledge to the intent, if no longer the gadget throws an exception.
Implicit intent will have to be export very similar to this:
<exercise android:identify=".AppActivity" android:exported="true"> <!-- This will have to be TRUE differently this may throw exception when beginning the activity--> <intent-filter> <motion android:identify="com.instance.motion.APP_ACTION" /> <class android:identify="android.intent.class.DEFAULT" /> </intent-filter> </exercise>
If pending intent will have to be mutable, then element data will have to be specified.
val flags = if (MerakiUtils.isApi31OrHigher()) { PendingIntent.FLAG_MUTABLE } else { PendingIntent.FLAG_UPDATE_CURRENT } val pendingIntent = PendingIntent.getActivity( this, 0, Intent(context, KioskActivity::elegance.java).follow { putExtra(ACTION, KioskActivity.BREAK_OUT_SINGLE_APP) }, flags )
Export conduct to be specified for Runtime-registered declares
Previous to Android 13, there have been no restrictions on sending declares to a dynamically registered receiver when it’s guarded by means of signature permission. While in Android 13, aiming at making runtime receivers protected, an not obligatory flag used to be offered to specify whether or not the receiver is exported and visual to different packages. To give protection to apps from safety vulnerabilities, in Android 14 or above context-registered receivers are required to specify a flag RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED to signify whether or not receiver will have to be exported or to not all different apps at the tool. That is exempted for gadget declares.
ContextCompat.registerReceiver( requireContext(), receiver,intentFilter(), ContextCompat.RECEIVER_NOT_EXPORTED
Non-Dismissable foreground notifications
In Android 14 or upper, foreground notification may also be pushed aside by means of the person. However exceptions were supplied for Tool coverage Controller (DPC) and supporting applications for endeavor.
JobScheduler reinforces callback and community conduct
Previous to Android 14, for any process working for too lengthy, it will forestall and fail silently. When App goals Android 14 and if the process exceeds the assured time at the major thread, the app triggers an ANR with an error message “No reaction to onStartJob” or “No reaction to onStopJob”. It’s endorsed to make use of WorkManager for any asynchronous processing.
Adjustments particular to Android Endeavor
Android Endeavor is a Google-led initiative to permit the usage of Android units and apps within the place of business. It’s also termed as Android for Paintings. It is helping to regulate and distribute non-public apps along public apps, offering a unified endeavor app retailer revel in for finish customers.
GET_PROVISIONING_MODE intent conduct
For signing in with a Google account, GET_PROVISIONING_MODE used to be offered in Android 12 or upper. In Android 14 or upper, DPC apps obtain this intent which is able to elevate the ideas to toughen both Absolutely controlled mode or paintings profile mode.
wipeDevice – for resetting tool
Scope of wipeData is now limited to profile homeowners handiest. For apps focused on Android 14 or upper, this technique would throw gadget error when referred to as in tool proprietor mode. New approach wipeDevice for use for resetting the tool along side USES_POLICY_WIPE_DATA permission.
Newly added fields and techniques
ContactsContract.Contacts#ENTERPRISE_CONTENT_URI
ContactsContract.CommonDataKinds.Telephone#ENTERPRISE_CONTENT_URI
When cross-profile contacts coverage is permitted in DevicePolicyManager, those fields can be utilized for list all paintings profile contacts and get in touch with numbers from non-public apps along side READ_CONTACTS permission.
To toughen environment touch get right of entry to coverage and callerID, under strategies are newly added;
setManagedProfileContactsAccessPolicy
getManagedProfileContactsAccessPolicy
setManagedProfileCallerIdAccessPolicy
getManagedProfileCallerIdAccessPolicy
Deprecated strategies
Underneath strategies are deprecated and as a substitute strategies specified within the earlier segment will have to be used.
DevicePolicyManger#setCrossProfileContactsSearchDisabled
DevicePolicyManger#getCrossProfileContactsSearchDisabled
DevicePolicyManger#setCrossProfileCallerIdDisabled
DevicePolicyManger#getCrossProfileCallerIdDisabled
Demanding situations all over Meraki Methods Supervisor App Migration
- To verify there used to be no UI breakage, we needed to recheck all of the code base of xml information associated with all fragments, alert conversation and textual content measurement dimensions.
- Few APIs like wipeDevice(), weren’t discussed within the Android migration 14. Throughout the trying out section it used to be discovered that wipeData() is deprecated in Android 14 and wipeDevice() used to be intended for use for manufacturing facility resetting the tool effectively.
- Profile knowledge which may also be fetched along side intent GET_PROVISIONING_MODE used to be additionally overlooked within the migration information. This used to be discovered all over the regression trying out section.
- requestSingleUpdate() of location supervisor at all times calls for mutable pending for location updation. However nowhere within the documentation, it’s prescribed about it. Because of this there have been few utility crashes. Needed to determine this out all over utility trying out.
Helpful hyperlinks for reference
Proportion: