activity-alias : Manage app upgrades, Two Launcher Icons

Alias for an activity which is specified with targetActivity attribute. Target activity should be in same application to that of alias. Target activity has to be declared before alias in manifest file. activity-alias can have its own attributes as we define for activity in manifest. It represents the target activity as an independent entity.


Apart from target Activity attribute, activity-alias attributes are a subset of activity attributes. If alias defines its own attributes, target activity attributes will not be applied. Though for attributes which are declared in target activity and not declared in alias, they will be applied to alias as well.

Alias and target Activity can have different intent-filter and each will behave as different entity even though name attribute of alias does not exist.

[su_box title=”Use of activity-alias” style=”soft” box_color=”#41ee54" radius=”11"]1. For application upgrade, package structure has changed. can be used to persist applications shortcuts and launcher icons.

2. We need two launcher activities with different icon in our application to take user to different usability/functionality view.

3. If there is minor functionality change between two screen, its better to use alias and use targetActivity rather than rewriting a complete class for alias activity.[/su[/su_box]

Sample activity-alias application

 

[su_[su_button url=”https://github.com/androidsrc/ActivityAlias” target=”blank” style=”stroked” background=”#51d461" color=”#ffffff” size=”6" center=”yes” radius=”0" icon=”icon: arrow-circle-o-down”]load Full Source Code[/su_butto[/su_button]

 [su_carous[su_carousel source=”media: 234,235,236" width=”700" height=”400" title=”no” mousewheel=”no”]t’s define layout for target activity, modify your /res/layout/activity_main.xml as below where we will use text view to show launch info.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *