AlexVPerl
AlexVPerl

Reputation: 7996

Android: Correct Way to Change Launcher Activity (Read Fully)

I'm facing the following issue. I have an app with an established user base, and I wanted to change my default launcher activity for the app.

The problem happens only for some users that updated the app via Google Play. Problem does not occur when running via Android Studio.

The problem comes into play with some of the users' Launchers on their phones. After they update the app, and when they try to open the app from their homescreens some users get "Error app not installed" or "Activity does not exist" errors.

It seems that on some users' devices, the OS launcher adds additional information about the activity name and this causes an issue after they update the app.

What's the correct way to change the launcher activity in order to avoid the problem I described above? This is quite an issue as a lot of non-techy users just uninstall the app.

Code:

    <activity android:name=".SplashActivity" android:screenOrientation="portrait" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name=".TabHostActivity" android:configChanges="keyboardHidden|orientation|screenSize">
    </activity>

Upvotes: 1

Views: 575

Answers (1)

Sush
Sush

Reputation: 6899

  1. Make TabHostActivity Launcher activity again.
  2. In TabHostActivity at first check if it has been opened from SplashActivity (You can add a flag in the intent while starting the TabHostActivity from SplashActivity and check the same flag in TabHostActivity)
  3. If TabHostActivity has not been opened from SplashActivity, then redirect to SplashActivity.
  4. All of the above should be coded before any other code in OnCreate of TabHostActivity.

Upvotes: 1

Related Questions