Skip to content

Commit d1e0694

Browse files
committed
erikre-oob2208-15363982 1.2
1 parent 6a31a6e commit d1e0694

8 files changed

Lines changed: 552 additions & 560 deletions

memdocs/intune/developer/app-sdk-android-appendix.md

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# required metadata
33

4-
title: Microsoft Intune App SDK for Android developer integration and testing guide, appendix
4+
title: Microsoft Intune App SDK for Android developer integration and testing guide
55
description: The Microsoft Intune App SDK for Android lets you incorporate Intune mobile app management (MAM) into your Android app.
66
keywords: SDK
77
author: Erikre
@@ -30,15 +30,12 @@ ms.collection:
3030
ms.custom: intune-classic
3131
---
3232

33-
3433
# Microsoft Intune App SDK for Android developer guide
35-
> [!NOTE]
36-
> This guide is broken into several distinct stages. Start at [Stage 1: Planning the Integration].
3734

38-
The Microsoft Intune App SDK for Android lets you incorporate Intune app protection policies (also known as **APP** or MAM policies) into your native Java/Kotlin Android app. An Intune-managed application is one that is integrated with the Intune App SDK. Intune administrators can easily deploy app protection policies to your Intune-managed app when Intune actively manages the app.
35+
The Microsoft Intune App SDK for Android lets you incorporate Intune app protection policies (also known as **APP*- or MAM policies) into your native Java/Kotlin Android app. An Intune-managed application is one that is integrated with the Intune App SDK. Intune administrators can easily deploy app protection policies to your Intune-managed app when Intune actively manages the app.
3936

4037
## Stage Goals
41-
The Appendix contains greater detail about the Intune App SDK's architecture, information about uncommon integration steps, and other helpful content.
38+
The guide contains greater detail about the Intune App SDK's architecture, information about uncommon integration steps, and other helpful content.
4239

4340
## The SDK in Greater Detail
4441

@@ -47,7 +44,7 @@ Through the [build tooling], the Intune App SDK attempts to minimize the integra
4744
Prior to the build tooling, developers needed to perform all replacements manually.
4845

4946
> [!NOTE]
50-
> Apps *must* now integrate with the SDK [build tooling], which will perform all of these replacements automatically (except for [manifest replacements]).
47+
> Apps *must- now integrate with the SDK [build tooling], which will perform all of these replacements automatically (except for [manifest replacements]).
5148
5249
Android base classes are replaced with their respective MAM equivalents in order to enable Intune management.
5350
The SDK classes live between the Android base class and the app's own derived version of that class.
@@ -73,7 +70,7 @@ The table below lists many of the MAM replacements.
7370
| android.app.ListActivity | MAMListActivity |
7471
| android.app.ListFragment | MAMListFragment |
7572
| android.app.NativeActivity | MAMNativeActivity |
76-
| android.app.PendingIntent | MAMPendingIntent (see [Pending Intent]) |
73+
| android.app.PendingIntent | MAMPendingIntent (see [Pending Intent]:#pendingintent) |
7774
| android.app.Service | MAMService |
7875
| android.app.TabActivity | MAMTabActivity |
7976
| android.app.TaskStackBuilder | MAMTaskStackBuilder |
@@ -113,7 +110,7 @@ For example, when deriving from [MAMActivity], instead of overriding `onCreate()
113110
The Java compiler should enforce the final restrictions to prevent accidental override of the original method instead of the MAM equivalent.
114111

115112
### Wrapped System Services
116-
For some system service classes, it is necessary to call a static
113+
For some system service classes, it's necessary to call a static
117114
method on a MAM wrapper class instead of directly invoking the desired
118115
method on the service instance.
119116
For example, a call to
@@ -138,13 +135,13 @@ Again, the required build plugin automatically makes these replacements.
138135
| android.app.blob.BlobStoreManager | MAMBlobStoreManager |
139136
| android.app.blob.BlobStoreManager.Session | MAMBlobStoreManager.Session |
140137

141-
Some classes have most of their methods wrapped, e.g. `ClipboardManager`, `ContentProviderClient`, `ContentResolver`,
142-
and `PackageManager` while other classes have only one or two methods wrapped, e.g. `DownloadManager`, `PrintManager`, `PrintHelper`,
138+
Some classes have most of their methods wrapped, for example, `ClipboardManager`, `ContentProviderClient`, `ContentResolver`,
139+
and `PackageManager` while other classes have only one or two methods wrapped, for example, `DownloadManager`, `PrintManager`, `PrintHelper`,
143140
`View`, `DragEvent`, `NotificationManager` and `NotificationManagerCompat`.
144141

145142
### Manifest Replacements
146-
It may be necessary to perform some of the above class replacements in the manifest as well as in Java code. Of special note:
147-
* Manifest references to `android.support.v4.content.FileProvider` must be replaced with `com.microsoft.intune.mam.client.support.v4.content.MAMFileProvider`.
143+
It may be necessary to perform some of the above class replacements in the manifest and in Java code. Of special note:
144+
- Manifest references to `android.support.v4.content.FileProvider` must be replaced with `com.microsoft.intune.mam.client.support.v4.content.MAMFileProvider`.
148145

149146
### MDM and MAM Enrollment
150147
As discussed in [Stage 4's Registration vs Enrollment], the Intune App SDK will "enroll" accounts that your app registers so that account is protected with policy.
@@ -156,7 +153,7 @@ MDM enrollment is entirely separate from App Protection Policy enrollment.
156153
An SDK-integrated app can have an account enrolled for App Protection Policy without that account being enrolled for Device Management.
157154
Likewise, a user can have enrolled a device for Device Management without having any SDK-integrated apps with accounts enrolled for App Protection Policy.
158155

159-
Typically, when developers and administrators refer to enrollment, they are referring to MDM enrollment, as App Protection Policy enrollment is largely invisible to both developers and end users.
156+
Typically, when developers and administrators refer to enrollment, they're referring to MDM enrollment, as App Protection Policy enrollment is largely invisible to both developers and end users.
160157
See [Enroll Android devices] for more details on MDM enrollment.
161158

162159
## Integration Tips
@@ -174,36 +171,36 @@ If you don't see your app's package name here, it indicates that the account log
174171
For description on each MAM policy setting, refer to
175172
[Android app protection policy settings in Microsoft Intune].
176173
For a description of how these settings will show up in the Company Portal logs, refer to [Review client app protection logs].
177-
When MAM policy is not being enforced as expected, we recommend that you check Company Portal logs or the diagnostic UI, verify that your app is managed by MAM policy, and confirm the policy settings have expected values.
174+
When MAM policy isn't being enforced as expected, we recommend that you check Company Portal logs or the diagnostic UI, verify that your app is managed by MAM policy, and confirm the policy settings have expected values.
178175

179176
You can collect Company Portal logs in one of the following ways:
180177
- Through the Company Portal
181178
- Open the Company Portal app
182-
- Click on the three dots menu on the up right corner
183-
- Click Settings
184-
- Under Diagnostic Logs, click Save Logs
179+
- Select on the three dots menu on the up right corner
180+
- Select Settings
181+
- Under Diagnostic Logs, select Save Logs
185182
- Follow the prompt to choose the output directory to save the Company Portal logs.
186183
- Use `adb shell pull` command to pull the logs from your Android device to your local machine.
187-
- [Use Edge for Android to access managed app logs]. This will display UI for
184+
- [Use Microsoft Edge for Android to access managed app logs]. This will display UI for
188185
collecting Company Portal logs and viewing MAM diagnostics.
189186
- Call `MAMPolicyManager.showDiagnostics(context)` to display the same UI for collecting Company Portal logs.
190187

191188
### Quickly testing with changing policy
192-
As you are developing and testing your app's integration of the Intune App SDK, you may frequently change the App Protection Policy settings for your test user.
189+
As you're developing and testing your app's integration of the Intune App SDK, you may frequently change the App Protection Policy settings for your test user.
193190

194-
By default, integrated apps will check-in with the Intune service for updated policy every 30 minutes, when active.
191+
By default, integrated apps will check in with the Intune service for updated policy every 30 minutes, when active.
195192
You can avoid this wait and force a check-in through the Company Portal:
196193

197-
1. Launch the Company Portal. You do not need to sign in.
198-
2. Click the ... menu icon.
199-
3. Click Settings.
194+
1. Launch the Company Portal. You don't need to sign in.
195+
2. Select the ... menu icon.
196+
3. Select Settings.
200197
4. Scroll to the setting called "Management Policy".
201198
5. Press the Sync button.
202199

203200
This will immediately schedule a check-in and will retrieve up-to-date policy targeted to your app and account.
204201

205202
### Troubleshooting AndroidX Migration
206-
If you integrated the Intune App SDK *before* leveraging AndroidX, you may encounter an error like this while migrating to AndroidX:
203+
If you integrated the Intune App SDK *before- leveraging AndroidX, you may encounter an error like this while migrating to AndroidX:
207204

208205
```log
209206
incompatible types: android.support.v7.app.ActionBar cannot be converted to androidx.appcompat.app.ActionBar
@@ -229,7 +226,7 @@ As discussed above, the MAM build plugin/tool will automatically rewrite classes
229226

230227
### Default enrollment
231228
Your application can alternately register for App Protection Policies through a simplified process called **default enrollment**.
232-
This feature is primarily to support private line-of-business apps that have not integrated MSAL.
229+
This feature is primarily to support private line-of-business apps that haven't integrated MSAL.
233230

234231
> [!WARNING]
235232
> Default enrollment comes with significant tradeoffs and is **not recommended**.
@@ -260,7 +257,7 @@ Enable default enrollment with the following steps:
260257
```
261258

262259
### Isolated Processes
263-
The Intune App SDK cannot apply protections to isolated processes.
260+
The Intune App SDK can't apply protections to isolated processes.
264261
Support for isolated processes (`android:isolatedProcess`) requires the addition of the meta-data tag below.
265262

266263
> [!Warning]
@@ -275,15 +272,15 @@ Support for isolated processes (`android:isolatedProcess`) requires the addition
275272
If your app contains a custom screen capture feature that bypasses Android's `Window`-level `FLAG_SECURE` restriction, you must check screen capture policy before allowing full access to the feature.
276273
For example, if your app uses a custom rendering engine to render the current view to a PNG file, you must first check `AppPolicy.getIsScreenCaptureAllowed()`.
277274

278-
If your app does not contain any custom or third-party screen capture features, you are not required to take any action to restrict screen captures.
275+
If your app doesn't contain any custom or third-party screen capture features, you aren't required to take any action to restrict screen captures.
279276
Screen capture policy is automatically enforced at the `Window` level for all MAM integrated apps.
280277

281278
Any attempts by the OS or another app to capture a `Window` in your app will be blocked as required.
282279
For example, if a user attempts to capture your app's screen through Android's built-in screenshot or screen recording features, the capture will be automatically restricted without participation from your app.
283280

284281
### Policy enforcement limitations
285282

286-
* **Using Content Resolvers**: The "transfer or receive" Intune policy may block or partially block the use of a content resolver to
283+
- **Using Content Resolvers**: The "transfer or receive" Intune policy may block or partially block the use of a content resolver to
287284
access the content provider in another app.
288285
This will cause `ContentResolver` methods to return null or throw a failure value (for example, `openOutputStream` will throw `FileNotFoundException` if blocked).
289286
The app can determine whether a failure to write data through a content resolver was caused by policy (or would be caused by policy) by making the call:
@@ -292,7 +289,7 @@ The app can determine whether a failure to write data through a content resolver
292289
MAMPolicyManager.getPolicy(currentActivity).getIsSaveToLocationAllowed(contentURI);
293290
```
294291

295-
or if there is no associated activity:
292+
or if there's no associated activity:
296293

297294
```java
298295
MAMPolicyManager.getCurrentThreadPolicy().getIsSaveToLocationAllowed(contentURI);
@@ -307,13 +304,13 @@ The service checks the caller to ensure that only the Company Portal is allowed
307304
### Reflection limitations
308305
Some of the MAM base classes (for example, `MAMActivity`, `MAMDocumentsProvider`) contain methods (based on the original Android base classes) which use parameter or return types only present above certain API levels.
309306
For this reason, it may not always be possible to use reflection to enumerate all methods of app components.
310-
This restriction is not limited to MAM, it is the same restriction that would apply if the app itself implemented these methods from the Android base classes.
307+
This restriction isn't limited to MAM, it's the same restriction that would apply if the app itself implemented these methods from the Android base classes.
311308

312309
### Robolectric
313-
Testing Intune App SDK behavior under Robolectric is not supported.
314-
There are known issues running the SDK under Robolectric due to behaviors present under Robolectric that do not accurately mimic those on real devices or emulators.
310+
Testing Intune App SDK behavior under Robolectric isn't supported.
311+
There are known issues running the SDK under Robolectric due to behaviors present under Robolectric that don't accurately mimic those on real devices or emulators.
315312

316-
If you need to test your application under Robolectric, the recommended workaround is to move your application class logic to a helper and produce your unit-testing apk with an application class that does not inherit from MAMApplication.
313+
If you need to test your application under Robolectric, the recommended workaround is to move your application class logic to a helper and produce your unit-testing apk with an application class that doesn't inherit from MAMApplication.
317314

318315

319316
<!-- Appendix links -->

0 commit comments

Comments
 (0)