Sha256: 4eda7779785fd860db105b7485215e416892cb2463874708784e9fd9cec2f0f9

Contents?: true

Size: 1.72 KB

Versions: 9

Compression:

Stored size: 1.72 KB

Contents

# activity_alias
Ensures that each `<activity-alias>` declared in the `AndroidManifest.xml` is valid.

## Will Skip If
* `AndroidManifest.xml` does not contain any `<activity-alias>` nodes.

## Will Fail If
* An `<activity-alias>` has a `targetActivity` which does not exist in the `AndroidManifest.xml`.
* An `<activity-alias>` does not contain an `<intent-filter>` or...
    * An `<intent-filter>` does not include `<action android:name="android.intent.action.MAIN" />`.
    * An `<intent-filter>` does not include `<category android:name="android.intent.category.LAUNCHER" />`.

## Exports
The `<activity-alias>` nodes present.

### Example
```json
{  
  "aliases":[
    {
      "name":"com.unity3d.player.UnityPlayerActivity",
      "targetActivity":"io.teak.sdk.wrapper.unity.TeakUnityPlayerActivity"
    }
  ]
}
```

## Reason
When an app changes the class of its main `<activity>` any shortcut that the app, or the user, has created will be removed.

To avoid this, apps can use `<activity-alias>` to redirect any reference to the old activity to a new activity.

An `<activity-alias>` must point to a valid `<activity>` and must include intent filters which will redirect the `android.intent.action.MAIN` action and `android.intent.category.LAUNCHER` category, otherwise shortcuts will not be preserved.

## Resolution
Make sure your `<activity-alias>` has a `targetActivity` which points to an `<activity>` defined in `AndroidManifest.xml`
```xml
<activity-alias
    android:name="your.old.activity.name"
    android:targetActivity="your.new.activity.name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity-alias>
```

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
headdesk-0.17.0 docs/activity_alias.md
headdesk-0.16.2 docs/activity_alias.md
headdesk-0.16.1 docs/activity_alias.md
headdesk-0.16.0 docs/activity_alias.md
headdesk-0.15.1 docs/activity_alias.md
headdesk-0.15.0 docs/activity_alias.md
headdesk-0.14.0 docs/activity_alias.md
headdesk-0.13.0 docs/activity_alias.md
headdesk-0.12.0 docs/activity_alias.md