You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: memdocs/intune/developer/app-sdk-android-appendix.md
+35-33Lines changed: 35 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
# required metadata
3
3
4
-
title: Microsoft Intune App SDK for Android developer integration and testing guide
4
+
title: Microsoft Intune App SDK for Android developer integration and testing guide, appendix
5
5
description: The Microsoft Intune App SDK for Android lets you incorporate Intune mobile app management (MAM) into your Android app.
6
6
keywords: SDK
7
7
author: Erikre
@@ -30,12 +30,15 @@ ms.collection:
30
30
ms.custom: intune-classic
31
31
---
32
32
33
+
33
34
# 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].
34
37
35
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.
36
39
37
40
## Stage Goals
38
-
The guide contains greater detail about the Intune App SDK's architecture, information about uncommon integration steps, and other helpful content.
41
+
The Appendix contains greater detail about the Intune App SDK's architecture, information about uncommon integration steps, and other helpful content.
39
42
40
43
## The SDK in Greater Detail
41
44
@@ -44,7 +47,7 @@ Through the [build tooling], the Intune App SDK attempts to minimize the integra
44
47
Prior to the build tooling, developers needed to perform all replacements manually.
45
48
46
49
> [!NOTE]
47
-
> Apps *must- now integrate with the SDK [build tooling], which will perform all of these replacements automatically (except for [manifest replacements]).
50
+
> Apps *must* now integrate with the SDK [build tooling], which will perform all of these replacements automatically (except for [manifest replacements]).
48
51
49
52
Android base classes are replaced with their respective MAM equivalents in order to enable Intune management.
50
53
The SDK classes live between the Android base class and the app's own derived version of that class.
@@ -70,7 +73,7 @@ The table below lists many of the MAM replacements.
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`,
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`,
140
143
`View`, `DragEvent`, `NotificationManager` and `NotificationManagerCompat`.
141
144
142
145
### Manifest Replacements
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`.
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`.
145
148
146
149
### MDM and MAM Enrollment
147
150
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.
@@ -153,7 +156,7 @@ MDM enrollment is entirely separate from App Protection Policy enrollment.
153
156
An SDK-integrated app can have an account enrolled for App Protection Policy without that account being enrolled for Device Management.
154
157
Likewise, a user can have enrolled a device for Device Management without having any SDK-integrated apps with accounts enrolled for App Protection Policy.
155
158
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.
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.
157
160
See [Enroll Android devices] for more details on MDM enrollment.
158
161
159
162
## Integration Tips
@@ -171,36 +174,36 @@ If you don't see your app's package name here, it indicates that the account log
171
174
For description on each MAM policy setting, refer to
172
175
[Android app protection policy settings in Microsoft Intune].
173
176
For a description of how these settings will show up in the Company Portal logs, refer to [Review client app protection logs].
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.
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.
175
178
176
179
You can collect Company Portal logs in one of the following ways:
177
180
- Through the Company Portal
178
181
- Open the Company Portal app
179
-
-Select on the three dots menu on the up right corner
180
-
-Select Settings
181
-
- Under Diagnostic Logs, select Save Logs
182
+
-Click on the three dots menu on the up right corner
183
+
-Click Settings
184
+
- Under Diagnostic Logs, click Save Logs
182
185
- Follow the prompt to choose the output directory to save the Company Portal logs.
183
186
- Use `adb shell pull` command to pull the logs from your Android device to your local machine.
184
-
-[Use Microsoft Edge for Android to access managed app logs]. This will display UI for
187
+
-[Use Edge for Android to access managed app logs]. This will display UI for
185
188
collecting Company Portal logs and viewing MAM diagnostics.
186
189
- Call `MAMPolicyManager.showDiagnostics(context)` to display the same UI for collecting Company Portal logs.
187
190
188
191
### Quickly testing with changing policy
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.
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.
190
193
191
-
By default, integrated apps will checkin with the Intune service for updated policy every 30 minutes, when active.
194
+
By default, integrated apps will check-in with the Intune service for updated policy every 30 minutes, when active.
192
195
You can avoid this wait and force a check-in through the Company Portal:
193
196
194
-
1. Launch the Company Portal. You don't need to sign in.
195
-
2.Select the ... menu icon.
196
-
3.Select Settings.
197
+
1. Launch the Company Portal. You do not need to sign in.
198
+
2.Click the ... menu icon.
199
+
3.Click Settings.
197
200
4. Scroll to the setting called "Management Policy".
198
201
5. Press the Sync button.
199
202
200
203
This will immediately schedule a check-in and will retrieve up-to-date policy targeted to your app and account.
201
204
202
205
### Troubleshooting AndroidX Migration
203
-
If you integrated the Intune App SDK *before- leveraging AndroidX, you may encounter an error like this while migrating to AndroidX:
206
+
If you integrated the Intune App SDK *before* leveraging AndroidX, you may encounter an error like this while migrating to AndroidX:
204
207
205
208
```log
206
209
incompatible types: android.support.v7.app.ActionBar cannot be converted to androidx.appcompat.app.ActionBar
@@ -226,7 +229,7 @@ As discussed above, the MAM build plugin/tool will automatically rewrite classes
226
229
227
230
### Default enrollment
228
231
Your application can alternately register for App Protection Policies through a simplified process called **default enrollment**.
229
-
This feature is primarily to support private line-of-business apps that haven't integrated MSAL.
232
+
This feature is primarily to support private line-of-business apps that have not integrated MSAL.
230
233
231
234
> [!WARNING]
232
235
> Default enrollment comes with significant tradeoffs and is **not recommended**.
@@ -241,8 +244,7 @@ Default enrollment will force the end user to install the Company Portal and com
241
244
Enable default enrollment with the following steps:
242
245
243
246
1. If your app integrates MSAL or you need to enable SSO,
following [common MSAL configurations](#common-msal-configurations)#2. If not, you may skip this step.
247
+
[configure MSAL]. If not, you may skip this step.
246
248
247
249
2. Enable default enrollment by adding the following value in the manifest under the `<application>` tag:
248
250
@@ -257,7 +259,7 @@ Enable default enrollment with the following steps:
257
259
```
258
260
259
261
### Isolated Processes
260
-
The Intune App SDK can't apply protections to isolated processes.
262
+
The Intune App SDK cannot apply protections to isolated processes.
261
263
Support for isolated processes (`android:isolatedProcess`) requires the addition of the meta-data tag below.
262
264
263
265
> [!Warning]
@@ -272,15 +274,15 @@ Support for isolated processes (`android:isolatedProcess`) requires the addition
272
274
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.
273
275
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()`.
274
276
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.
277
+
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.
276
278
Screen capture policy is automatically enforced at the `Window` level for all MAM integrated apps.
277
279
278
280
Any attempts by the OS or another app to capture a `Window` in your app will be blocked as required.
279
281
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.
280
282
281
283
### Policy enforcement limitations
282
284
283
-
-**Using Content Resolvers**: The "transfer or receive" Intune policy may block or partially block the use of a content resolver to
285
+
***Using Content Resolvers**: The "transfer or receive" Intune policy may block or partially block the use of a content resolver to
284
286
access the content provider in another app.
285
287
This will cause `ContentResolver` methods to return null or throw a failure value (for example, `openOutputStream` will throw `FileNotFoundException` if blocked).
286
288
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:
@@ -289,7 +291,7 @@ The app can determine whether a failure to write data through a content resolver
@@ -304,25 +306,25 @@ The service checks the caller to ensure that only the Company Portal is allowed
304
306
### Reflection limitations
305
307
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.
306
308
For this reason, it may not always be possible to use reflection to enumerate all methods of app components.
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.
309
+
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.
308
310
309
311
### Robolectric
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.
312
+
Testing Intune App SDK behavior under Robolectric is not supported.
313
+
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.
312
314
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.
315
+
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.
314
316
315
317
316
318
<!-- Appendix links -->
317
319
<!-- internal links -->
318
320
[manifest replacements]:#manifest-replacements
319
321
[some method calls must also be replaced]:#wrapped-system-services
320
-
[Pending Intent]:#pendingintent
321
322
[MAMApplication]:#mamapplication
322
323
323
324
<!-- Other SDK Guide Markdown docs -->
324
325
[Stage 1: Planning the Integration]:app-sdk-android-phase1.md
0 commit comments