com.google.android.gms.instantapps.PackageManagerCompat |
![]() |
A helper for accessing features in PackageManager
in a backwards
compatible fashion. Construct this by using getPackageManagerCompat(Context)
.
This helper exposes methods otherwise only available on some API levels. For other methods
that exist on all API levels (e.g. getPackagesForUid(int)
it will augment the results with
data about instant apps as well as installed apps.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieve all of the information we know about a particular
package/application.
| |||||||||||
Return the label to use for this application.
| |||||||||||
Retrieve overall information about an application package that is
installed on the system or a running instant app.
| |||||||||||
Retrieve the names of all packages that are associated with a particular
user id.
| |||||||||||
Returns true if this application is an instant app.
| |||||||||||
Returns true if the provided package is that of a running instant app that has whitelisted the
calling application.
|
Retrieve all of the information we know about a particular package/application.
Information about installed apps will only be returned if requested when constructing the implementation of this interface; information about instant apps will only be returned if they are running and have whitelisted the calling application.
Parameters | |
---|---|
packageName |
String :
the full name (i.e. com.google.apps.contacts) of an
application |
flags |
int :
additional option flags. Supported flags are defined in
getApplicationInfo(String, int) ; instant apps will return
data for the flag GET_META_DATA . |
Returns | |
---|---|
ApplicationInfo |
ApplicationInfo object containing information about the package. |
Throws | |
---|---|
PackageManager.NameNotFoundException |
if a package with the given name is not installed (or was not requested) and is not a package name of a running instant app |
See also:
Return the label to use for this application.
Information about installed apps will only be returned if requested when constructing the implementation of this interface; information about instant apps will only be returned if they are running and have whitelisted the calling application.
Parameters | |
---|---|
info |
ApplicationInfo :
The application to get the label of. |
Returns | |
---|---|
CharSequence |
Returns the label associated with this application, or null if it could not be found for any reason. |
See also:
Retrieve overall information about an application package that is installed on the system or a running instant app.
Information about installed apps will only be returned if requested when constructing the implementation of this interface; information about instant apps will only be returned if they are running and have whitelisted the calling application.
Parameters | |
---|---|
packageName |
String :
the full name (i.e. com.google.apps.contacts) of the
desired package |
flags |
int :
additional option flags. Supported flags are defined in
getPackageInfo(String, int) ; instant apps will return data
for the flags GET_ACTIVITIES ,
GET_CONFIGURATIONS ,
GET_META_DATA , GET_PERMISSIONS ,
and GET_SIGNATURES |
Returns | |
---|---|
PackageInfo |
PackageInfo object containing information about the package. |
Throws | |
---|---|
PackageManager.NameNotFoundException |
if a package with the given name is not installed (or was not requested) and is not a package name of a running instant app |
See also:
Retrieve the names of all packages that are associated with a particular user id.
Information about installed apps will only be returned if requested when constructing the implementation of this interface; information about instant apps will only be returned if they are running and have whitelisted the calling application.
Parameters | |
---|---|
uid |
int :
the user id for which you would like to retrieve the
associated packages |
Returns | |
---|---|
String[] |
an array of one or more packages assigned to the user id, or null if there are no known packages with the given id |
See also:
Returns true if this application is an instant app.
Returns | |
---|---|
boolean |
true if this application is an instant app, false otherwise. |
Returns true if the provided package is that of a running instant app that has whitelisted the calling application.
Parameters | |
---|---|
packageName |
String :
the package you want to check for being an instant app. |
Returns | |
---|---|
boolean |
true if the package is that of a running instant app, false otherwise. |