|
4 | 4 | <qhelp> |
5 | 5 | <overview> |
6 | 6 | <p> |
7 | | - Android allows an application to install an APK (Android package kit) |
| 7 | + Android allows an application to install an Android Package Kit (APK) |
8 | 8 | using an <code>Intent</code> with |
9 | 9 | the <code>"application/vnd.android.package-archive"</code> MIME type. If |
10 | 10 | the file used in the <code>Intent</code> is from a location that is not |
11 | | - controlled by the application (for example, the SD card which is |
12 | | - universally writable), this can result in the installation of an |
13 | | - application which was not intended. |
| 11 | + controlled by the application (for example, an SD card that is |
| 12 | + universally writable), this can result in the unintended installation of untrusted applications. |
14 | 13 | </p> |
15 | 14 | </overview> |
16 | 15 |
|
17 | 16 | <recommendation> |
18 | 17 | <p> |
19 | | - It is advised to transition to install packages using |
| 18 | + You should install packages using |
20 | 19 | the <code>PackageInstaller</code> class. |
21 | 20 | </p> |
22 | 21 |
|
23 | 22 | <p> |
24 | | - If installation from a file is necessary, it is best to use |
| 23 | + If you need to install from a file, you should use |
25 | 24 | a <code>FileProvider</code>. Content providers can provide more specific |
26 | 25 | permissions than file system permissions can. |
27 | 26 | </p> |
28 | 27 |
|
29 | 28 | <p> |
30 | | - When your application does not require installing packages, do not add |
| 29 | + When your application does not require package installations, do not add |
31 | 30 | the <code>REQUEST_INSTALL_PACKAGES</code> permission in the manifest file. |
32 | 31 | </p> |
33 | 32 | </recommendation> |
|
36 | 35 |
|
37 | 36 | <p> |
38 | 37 | In the following (bad) example, the package is installed from a file which |
39 | | - may be altered by another application. |
| 38 | + may be altered by another application: |
40 | 39 | </p> |
41 | 40 |
|
42 | 41 | <sample src="InstallApkWithFile.java"/> |
43 | 42 |
|
44 | 43 | <p> |
45 | 44 | In the following (good) example, the package is installed by using |
46 | | - a <code>FileProvider</code>. |
| 45 | + a <code>FileProvider</code>: |
47 | 46 | </p> |
48 | 47 |
|
49 | 48 | <sample src="InstallApkWithFileProvider.java"/> |
50 | 49 |
|
51 | 50 | <p> |
52 | 51 | In the following (good) example, the package is installed using an |
53 | | - instance of the <code>android.content.pm.PackageInstaller</code> class. |
| 52 | + instance of the <code>android.content.pm.PackageInstaller</code> class: |
54 | 53 | </p> |
55 | 54 |
|
56 | 55 | <sample src="InstallApkWithPackageInstaller.java"/> |
|
0 commit comments