Search code examples
androidandroid-activityandroid-animation

How to create an Android app whose only purpose is to launch another app?


While customizing my phone I'm trying to make an app that's just the Google Weather app, with a custom icon. I just want it to work exactly like this app on the Play Store.

With every single code I find on the internet there's always the app-switching animation that I can't get rid of. I have tried to use overridePendingTransition(0, 0) in the code and <item name="android:windowAnimationStyle">@null</item> in the theme, but nothing changed. How can I get around this?


Solution

  • After a bit of trial and error I've managed to get it working properly. I just needed to set the theme of the app like this:

    ...
    <application
    ...
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    ...
    

    and after doing so, I needed to have my MainActivity to be a normal Activity and not an AppCompatActivity, like this:

    class MainActivity : Activity()
    

    and eventually just start the desired activity in the onResume method:

        override fun onResume() {
            super.onResume()
    
            startActivity(
                Intent().setComponent(
                    ComponentName(
                        "com.google.android.googlequicksearchbox",
                        "com.google.android.apps.search.weather.WeatherExportedActivity"
                    )
                )
            )
            finish()
        }