It was hard to summarize the problem in the title but it's really not very complicated.
My problem is this: After installing an app you see an "Open app" button on the play store which initiates your app similarly to when you click run on Eclipse. When you do either of these things the first launcher activity found in the manifest is brought to started.
For example if this were my manifest:
<!-- Home screen replacemnt -->
<activity
android:name=".launcher" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Launcher Application -->
<activity
android:name=".SettingsActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When open was clicked SettingsActivity
would be started since the first activity isn't a launcher app.
My problem is that the first time users open my app I want them to see the launcher. how do I make sure .launcher
is started when my application is opened?
The intent-filter inside the activity tells Android which Activity to launch.
Unlike programming paradigms in which apps are launched with a main() method, the Android system initiates code in an Activity instance by invoking specific callback methods that correspond to specific stages of its lifecycle.
If both application have the same signature (meaning that both APPS are yours and signed with the same key), you can call your other app activity as follows: Intent LaunchIntent = getActivity(). getPackageManager(). getLaunchIntentForPackage(CALC_PACKAGE_NAME); startActivity(LaunchIntent);
You can start a service from an activity or other application component by passing an Intent to startService() or startForegroundService() . The Android system calls the service's onStartCommand() method and passes it the Intent , which specifies which service to start.
To use App Startup to initialize components automatically at startup, you must define a component initializer for each component that the app needs to initialize. You define each component initializer by creating a class that implements the Initializer<T> interface.
App Startup. The App Startup library provides a straightforward, performant way to initialize components at application startup. Both library developers and app developers can use App Startup to streamline startup sequences and explicitly set the order of initialization. Instead of defining separate content providers for each component you need ...
Suppose that your app also depends on a library called ExampleLogger, which in turn depends on WorkManager. This dependency means that you need to make sure that App Startup initializes WorkManager first.
To create the second activity, follow these steps: In the Project window, right-click the app folder and select New > Activity > Empty Activity. In the Configure Activity window, enter "DisplayMessageActivity" for Activity Name.
You should not distinguish this based on the Intent level. Instead, have a SharedPreferences file for your app, in which you write an integer representing the version if it does not yet exist resp. indicates an older version. Then, based on that mechanism, you implement your "first time install" and/or "first run after update" logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With