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
+31-34Lines changed: 31 additions & 34 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, appendix
4
+
title: Microsoft Intune App SDK for Android developer integration and testing guide
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,15 +30,12 @@ ms.collection:
30
30
ms.custom: intune-classic
31
31
---
32
32
33
-
34
33
# 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].
37
34
38
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.
39
36
40
37
## 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.
42
39
43
40
## The SDK in Greater Detail
44
41
@@ -47,7 +44,7 @@ Through the [build tooling], the Intune App SDK attempts to minimize the integra
47
44
Prior to the build tooling, developers needed to perform all replacements manually.
48
45
49
46
> [!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]).
51
48
52
49
Android base classes are replaced with their respective MAM equivalents in order to enable Intune management.
53
50
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.
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`,
143
140
`View`, `DragEvent`, `NotificationManager` and `NotificationManagerCompat`.
144
141
145
142
### 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`.
148
145
149
146
### MDM and MAM Enrollment
150
147
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.
156
153
An SDK-integrated app can have an account enrolled for App Protection Policy without that account being enrolled for Device Management.
157
154
Likewise, a user can have enrolled a device for Device Management without having any SDK-integrated apps with accounts enrolled for App Protection Policy.
158
155
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.
160
157
See [Enroll Android devices] for more details on MDM enrollment.
161
158
162
159
## Integration Tips
@@ -174,36 +171,36 @@ If you don't see your app's package name here, it indicates that the account log
174
171
For description on each MAM policy setting, refer to
175
172
[Android app protection policy settings in Microsoft Intune].
176
173
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.
178
175
179
176
You can collect Company Portal logs in one of the following ways:
180
177
- Through the Company Portal
181
178
- 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
185
182
- Follow the prompt to choose the output directory to save the Company Portal logs.
186
183
- 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
188
185
collecting Company Portal logs and viewing MAM diagnostics.
189
186
- Call `MAMPolicyManager.showDiagnostics(context)` to display the same UI for collecting Company Portal logs.
190
187
191
188
### 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.
193
190
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 checkin with the Intune service for updated policy every 30 minutes, when active.
195
192
You can avoid this wait and force a check-in through the Company Portal:
196
193
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.
200
197
4. Scroll to the setting called "Management Policy".
201
198
5. Press the Sync button.
202
199
203
200
This will immediately schedule a check-in and will retrieve up-to-date policy targeted to your app and account.
204
201
205
202
### 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:
207
204
208
205
```log
209
206
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
229
226
230
227
### Default enrollment
231
228
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.
233
230
234
231
> [!WARNING]
235
232
> Default enrollment comes with significant tradeoffs and is **not recommended**.
@@ -259,7 +256,7 @@ Enable default enrollment with the following steps:
259
256
```
260
257
261
258
### Isolated Processes
262
-
The Intune App SDK cannot apply protections to isolated processes.
259
+
The Intune App SDK can't apply protections to isolated processes.
263
260
Support for isolated processes (`android:isolatedProcess`) requires the addition of the meta-data tag below.
264
261
265
262
> [!Warning]
@@ -274,15 +271,15 @@ Support for isolated processes (`android:isolatedProcess`) requires the addition
274
271
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.
275
272
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()`.
276
273
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.
274
+
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.
278
275
Screen capture policy is automatically enforced at the `Window` level for all MAM integrated apps.
279
276
280
277
Any attempts by the OS or another app to capture a `Window` in your app will be blocked as required.
281
278
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.
282
279
283
280
### Policy enforcement limitations
284
281
285
-
***Using Content Resolvers**: The "transfer or receive" Intune policy may block or partially block the use of a content resolver to
282
+
-**Using Content Resolvers**: The "transfer or receive" Intune policy may block or partially block the use of a content resolver to
286
283
access the content provider in another app.
287
284
This will cause `ContentResolver` methods to return null or throw a failure value (for example, `openOutputStream` will throw `FileNotFoundException` if blocked).
288
285
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:
@@ -291,7 +288,7 @@ The app can determine whether a failure to write data through a content resolver
@@ -306,25 +303,25 @@ The service checks the caller to ensure that only the Company Portal is allowed
306
303
### Reflection limitations
307
304
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.
308
305
For this reason, it may not always be possible to use reflection to enumerate all methods of app components.
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.
306
+
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.
310
307
311
308
### Robolectric
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.
309
+
Testing Intune App SDK behavior under Robolectric isn't supported.
310
+
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.
314
311
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.
312
+
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.
316
313
317
314
318
315
<!-- Appendix links -->
319
316
<!-- internal links -->
320
317
[manifest replacements]:#manifest-replacements
321
318
[some method calls must also be replaced]:#wrapped-system-services
319
+
[Pending Intent]:#pendingintent
322
320
[MAMApplication]:#mamapplication
323
321
324
322
<!-- Other SDK Guide Markdown docs -->
325
323
[Stage 1: Planning the Integration]:app-sdk-android-phase1.md
0 commit comments