I have made a simple app with 3 activities: 1. Login 2. Rating 3. Summary
The login activity allows Google to sign in. If the user is already signed in I start the Rating activity. The code is as below
In the Rating activity, I check if the user has submitted the rating for the day. I use SharedPreferences to store any previous rating information. I also have a node API working at the back end to record the rating. If the app is not able to find a local SharedPreference for the rating details I do a GET request from the API to cross verify. If the rating info is available for the day, the Summary Activity will be opened.
In addition i have added a functionality to quit the app by pressing the back button from either the Rating Activity or the Summary Activity.
The problem is, every time I run the app and debug with my phone 2 instances are listed with the same name and icon in the Home screen. The installed apps list shows only 1 app with the name
The first one opens the app and works as expected.
Whereas the 2nd one always opens at the Summary activity and shows blank content (irrespective of whether I have done the rating in Rating activity or not).
Why does it show 2 instances in my phone's home screen? Please let me know if I need to share any files for better understanding.
Most likely, you have two <activity>
elements in your manifest that contain this:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If you only want one activity in the home screen's launcher, put that <intent-filter>
on only that one activity. Get rid of the <intent-filter>
from the other activity.