public abstract class TileAbility
extends ohos.aafwk.ability.Ability
You need to implement onStatusChanged(ohos.wearable.tile.TileStatus) on a TileAbility object with the tile lifecycle
state passed to return a TileEntity object as defined.
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static java.lang.String |
ACTION_REQUEST_UPDATE |
Indicates the action declared for the child class of
TileAbility to request an update. |
static java.lang.String |
ACTION_TILE |
Indicates the action declared for the child class of
TileAbility in the config.json file. |
static java.lang.String |
ACTION_TILE_DEFAULT |
Indicates the action declared for the child class of
TileAbility in the config.json file for a
tile to be displayed in the visible tile list by default. |
static java.lang.String |
EXTRA_CLASS_NAME |
Indicates the name of the child class of
TileAbility. |
static java.lang.String |
EXTRA_PACKAGE_NAME |
Indicates the package name of the child class of
TileAbility. |
static java.lang.String |
EXTRA_TILE_IDS |
Indicates the tile ID.
|
| 构造器 | 说明 |
|---|---|
TileAbility() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
isInRetailMode() |
Checks whether the current system is in retail mode.
|
void |
notifyDataChanged(ohos.app.Context context,
ohos.bundle.ElementName elementName) |
Notifies the system of tile data changes.
|
protected ohos.rpc.IRemoteObject |
onConnect(ohos.aafwk.content.Intent intent) |
|
protected void |
onDisconnect(ohos.aafwk.content.Intent intent) |
|
protected abstract TileEntity |
onStatusChanged(TileStatus status) |
Called when the tile state changes.
|
addActionRoute, batchInsert, call, cancelBackgroundRunning, connectAbility, continueAbility, continueAbility, continueAbilityReversibly, continueAbilityReversibly, createPipeFile, delete, denormalizeUri, disconnectAbility, dispatchAccessibilityEventInfo, executeBatch, executeOperation, findComponentById, getAbilityName, getAbilityPackage, getAdmissionTransitionConcurEnabled, getAdmissionTransitionObject, getAVController, getBackTransitionConcurEnabled, getBackTransitionObject, getContinuationRegisterManager, getContinuationState, getCurrentFocus, getFileTypes, getIntent, getLayoutParams, getLifecycle, getOriginalDeviceId, getQuitTransitionObject, getReadmissionTransitionObject, getSharedItemAdmissionTransitionObject, getSharedItemBackTransitionObject, getSharedItemQuitTransitionObject, getSharedItemReadmissionTransitionObject, getState, getType, getVolumeTypeAdjustedByKey, getWindow, hasWindowFocus, insert, isTemporary, isTerminating, keepBackgroundRunning, normalizeUri, onAbilityResult, onAcquireFormState, onActive, onBackground, onBackPressed, onCastTempForm, onCommand, onCommand, onConfigurationUpdated, onCreateForm, onCreateForm, onDeleteForm, onDeleteForm, onEventDispatch, onEventNotify, onForeground, onHotkeyTriggered, onInactive, onInitialized, onKeyDown, onKeyPressAndHold, onKeyUp, onLeaveForeground, onMemoryLevel, onMissionDeleted, onNewDescription, onNewIntent, onOrientationChanged, onPostActive, onPostStart, onReconnect, onRequestPermissionsFromUserResult, onRestoreAbilityState, onSaveAbilityState, onSetCaller, onStart, onStop, onStoreDataWhenConfigChange, onTopActiveAbilityChanged, onTouchEvent, onTriggerFormEvent, onTriggerFormEvent, onUnloadForm, onUpdateForm, onUpdateForm, onWindowFocusChanged, openFile, openRawFile, parsePredictionArgsReference, parseValuesBucketReference, postTask, query, reload, reverseContinueAbility, setAbilitySliceAnimator, setAdmissionTransitionConcurEnabled, setAdmissionTransitionObject, setAVController, setBackTransitionConcurEnabled, setBackTransitionObject, setFormNextRefreshTime, setIntent, setIsAmbientMode, setLayoutParams, setMainRoute, setQuitTransitionObject, setReadmissionTransitionObject, setResult, setSharedItemAdmissionTransitionObject, setSharedItemBackTransitionObject, setSharedItemQuitTransitionObject, setSharedItemReadmissionTransitionObject, setSwipeToDismiss, setUIContent, setUIContent, setVolumeTypeAdjustedByKey, setWindowBackgroundColor, shutdown, startAbility, startAbility, startAbility, startAbility, startAbilityForResult, startAbilityForResult, startAssistAbility, stopAbility, stopAssistAbility, supportHighPerformanceUI, terminateAbility, update, updateForm, updateForm, updateForm, updateFormattachBaseContext, canRequestPermission, compelVerifyCallerPermission, compelVerifyCallerUriPermission, compelVerifyPermission, compelVerifyPermission, compelVerifyUriPermission, compelVerifyUriPermission, compelVerifyUriPermission, createBundleContext, createParallelTaskDispatcher, createSerialTaskDispatcher, deleteFile, displayUnlockMissionMessage, getAbilityInfo, getAbilityManager, getAbilityPackageContext, getApplicationContext, getApplicationInfo, getAppType, getBundleCodePath, getBundleManager, getBundleName, getBundleResourcePath, getCacheDir, getCaller, getCallingAbility, getCallingBundle, getClassloader, getCodeCacheDir, getColor, getColorMode, getContext, getDatabaseDir, getDataDir, getDir, getDisplayOrientation, getDistributedDir, getElementName, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getGlobalTaskDispatcher, getHapModuleInfo, getIntArray, getLastStoredDataWhenConfigChanged, getLocalClassName, getMainTaskDispatcher, getNoBackupFilesDir, getPattern, getPreferencesDir, getProcessInfo, getProcessName, getResourceManager, getResourceManager, getString, getString, getStringArray, getTheme, getThemeId, getUITaskDispatcher, init, isCredentialEncryptedStorage, isDeviceEncryptedStorage, isUpdatingConfigurations, lockMission, printDrawnCompleted, requestPermissionsFromUser, restart, setColorMode, setDisplayOrientation, setPattern, setShowOnLockScreen, setTheme, setTransitionAnimation, setWakeUpScreen, startAbilities, startAbility, startAbility, startAbility, switchToCredentialEncryptedStorageContext, switchToDeviceEncryptedStorageContext, terminateAbility, terminateAbilityResult, unlockMission, verifyCallingOrSelfPermission, verifyCallingPermission, verifyPermission, verifySelfPermissionpublic static final java.lang.String ACTION_REQUEST_UPDATE
TileAbility to request an update.
This action is sent to the system when notifyDataChanged(ohos.app.Context,ohos.bundle.ElementName) is called on the child
class of TileAbility to request the system to update this tile.
public static final java.lang.String ACTION_TILE
TileAbility in the config.json file.
After the system recognizes this action, the tile becomes selectable and can be added to the visible tile list.
public static final java.lang.String ACTION_TILE_DEFAULT
TileAbility in the config.json file for a
tile to be displayed in the visible tile list by default.
When an application is installed, the tile holding this application and declared with this action is automatically added to the visible tile list.
public static final java.lang.String EXTRA_CLASS_NAME
TileAbility.
The child class name is sent to the system when notifyDataChanged(ohos.app.Context,ohos.bundle.ElementName) is called on the
child class of TileAbility to request the system to update this tile.
public static final java.lang.String EXTRA_PACKAGE_NAME
TileAbility.
The package name is sent to the system when notifyDataChanged(ohos.app.Context,ohos.bundle.ElementName) is called on the
child class of TileAbility to request the system to update this tile.
public static final java.lang.String EXTRA_TILE_IDS
The tile ID is sent to the system when notifyDataChanged(ohos.app.Context,ohos.bundle.ElementName) is called on the child
class of TileAbility to request the system to update this tile.
protected ohos.rpc.IRemoteObject onConnect(ohos.aafwk.content.Intent intent)
onConnect 在类中 ohos.aafwk.ability.Abilityprotected void onDisconnect(ohos.aafwk.content.Intent intent)
onDisconnect 在类中 ohos.aafwk.ability.Abilityprotected abstract TileEntity onStatusChanged(TileStatus status)
When the tile state changes, for example, the tile is selected or released, this callback is invoked to notify
the TileAbility so that subsequent operations are performed based on TileStatus.
status - Indicates the tile state.TileEntity object if this tile is in the TileStatus#TILE_SELECTED or
TileStatus#TILE_UPDATE state; returns a TileEntity object or null if the tile is in any
other state.public final boolean isInRetailMode()
For some applications, different tile content needs to be displayed in retail and non-retail modes. You need to call this method if retail mode-related services need to be processed.
true if the current system is in retail mode; returns false otherwise.public final void notifyDataChanged(ohos.app.Context context,
ohos.bundle.ElementName elementName)
Upon receiving the notification, the tile system calls onStatusChanged(ohos.wearable.tile.TileStatus) to pass
TileStatus#TILE_UPDATE to return a TileEntity object for updating.
context - Indicates the context object of the caller.elementName - Indicates the element name of the caller, which identifies a TileAbility object.