Search code examples
androidiconsmanifestlauncher

Two shortcut with Two Icons for the same App


So , i want to have an additional Shortcut with another Icon for the same App , this additional Shortcut , Visible in App Drawer , should launch a Simple Activity/Service ,

it is Possible , If yes How ? If Possible , Programmaticly ,

Does its matter with < application > Tag ? ,

Thanks


Solution

  • Of course you can have two or more launcher activities in your application. Just set an intent filter with launch attributes.

    <activity
        android:name=".SecondActivity"
        android:icon="@drawable/ic_second_launcher">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    

    If you want to start a service from the AppDrawer, just call an empty Activty which starts the Service in onCreate