MobileApplication
@ExperimentalAppSearchApi
@Document(name = "builtin:MobileApplication")
public class MobileApplication extends Thing
| java.lang.Object | ||
| ↳ | androidx.appsearch.builtintypes.Thing | |
| ↳ | androidx.appsearch.builtintypes.MobileApplication |
Represents an installed app to enable searching using names, nicknames, and package names.
Summary
Nested types |
|---|
public final class MobileApplication.BuilderBuilder class for |
Public methods |
|
|---|---|
@NonNull List<String> |
Returns alternative names of the application. |
@Nullable String |
Returns the fully qualified name of the Application class for this mobile app. |
@Nullable String |
Returns the display name of the app. |
@Nullable Uri |
Returns the full name of the resource identifier of the app icon, which can be used for displaying results. |
@NonNull String |
Returns the package name this |
@NonNull byte[] |
Returns the SHA-256 certificate of the application. |
long |
Returns the last time the app was installed or updated on the device. |
Inherited methods |
||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public methods
getAlternateNames
public @NonNull List<String> getAlternateNames()
Returns alternative names of the application. These are indexed. For example, you might have the alternative name "pay" for a wallet app.
getClassName
public @Nullable String getClassName()
Returns the fully qualified name of the Application class for this mobile app. This would look something like "com.android.vending.SearchActivity". Combined with the package name, a launch intent can be created with
Intent launcher = new Intent(Intent.ACTION_MAIN);
launcher.setComponent(new ComponentName(app.getPackageName(), app.getClassName()));
launcher.setPackage(app.getPackageName());
launcher.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launcher.addCategory(Intent.CATEGORY_LAUNCHER);
appListFragment.getActivity().startActivity(launcher);
getDisplayName
public @Nullable String getDisplayName()
Returns the display name of the app. This is indexed. This is what is displayed in the launcher. This might look like "Play Store".
getIconUri
public @Nullable Uri getIconUri()
Returns the full name of the resource identifier of the app icon, which can be used for displaying results. The Uri could be "android.resource://com.example.vending/drawable/2131230871", for example.
getPackageName
public @NonNull String getPackageName()
Returns the package name this MobileApplication represents. For example, "com.android.vending".
getSha256Certificate
public @NonNull byte[] getSha256Certificate()
Returns the SHA-256 certificate of the application.
getUpdatedTimestampMillis
public long getUpdatedTimestampMillis()
Returns the last time the app was installed or updated on the device.