|
Pro Android with Kotlin@de android telegram Pro Android with Kotlin Developing Modern Mobile10
CHAPTER 2: Application
The most important attribute of the root entry
is called
package
. It declares the ID
of your app, and if you plan to publish your app, this must be a worldwide unique ID for it.
A good idea is to use your domain (or your company’s domain) reversed and then an unique
application identifier, as shown in the previous code.
Table
2-1
describes all the possible attributes of
. Note that for the simplest apps,
all you need is the
package
attribute and a single
child.
Table 2-1.
Manifest Main Attributes
Name
Description
android: installLocation
Defines the installation location. Use
internalOnly
for installing
only in the internal storage,
auto
for letting the OS decide with
affinity toward using the internal storage (the user can switch
later in the system settings), or
preferExternal
for letting the OS
decide with affinity toward using the external storage. The default
is
internalOnly
. Note that a couple of restrictions apply to using
external storage for that aim; see the online documentation for
. For modern devices with lots of free internal storage, you
should never need to specify
preferExternal
here.
package
Defines the worldwide unique ID of your app and is a string like
abc.
def.ghi.[...]
where the nondot characters may contain the letters
A–Z and a–z, the numbers 0–9, and underscores. Don’t use a number
after a dot! This is also the default process name and the default
task affinity; see the online text companion to learn what those
mean. Note that once your app is published, you cannot change this
package name in the Google Play Store. There is no default; you
must set this attribute.
android: sharedUserId
Defines the name of the Android OS user ID assigned to the app. You
can prior to Android 8.0 or API level 26 do things such as assigning
the same user ID to different apps, which lets them freely interchange
data. The apps must then be signed with the same certificate.
However, you normally don’t have to set this attribute, but if you set
it, make sure you know what you are doing.
android: sharedUserLabel
If you also set
sharedUserId
, you can set a user-readable label for
the shared user ID here. The value must be a reference to a string
resource (for example,
@string/myUserLabel
).
android:
targetSandboxVersion
Serves as a security level and is either 1 or 2. Starting with Android
8.0 or API level 26, you
must
set it to 2. With 2, the user ID can no
longer be shared between different apps, and the default value for
usesClearTextTraffic
(see the online text companion) is set to false.
android: versionCode
Defines an internal version number of your app. This is not shown to
users and used only for comparing versions. Use an integer number
here. This defaults to
undefined
.
android: versionName
Defines a user-visible version string. This is either the string itself or
a pointer to a string resource (
"@string/..."
). This is not used for
anything else but informing the user.
|
|
|