Want my app on Launchers Homescreen - android

Hey in the Launcher code I want one app to be shown on homescreen , in AndroidManifest.xml. I wrote these lines :
<activity
android:name=".MyAppTabs"
android:theme="#android:style/Theme.NoTitleBar"
android:label="MyApp"
android:icon="#drawable/ic_launcher_app">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
on adding these lines I am getting my app on the homescreen but it is not launching, but using Menu option I am able to launch my app...Any help??
Adiing more details.. I have default_workspace.xml file in xml folder where I am adding my app to favorite tag...
<favorite
launcher:packageName="com.android.launcher"
launcher:className="com.android.launcher.apps.MyAppTabs"
launcher:screen="3"
launcher:x="3"
launcher:y="0" />
If any other information required ..Please tell me.

This can be acheived only for the applications which is part of the same application (In this case your Launcher).
You should not start the activity of the application which you want to run inside of laucher
You should get the parent view where the applcation wants to be shown,
Get application design as single view or view group, consider this as child (this would be the child of launcher parent view)
Add child apllication view into launcher parent view.

Related

Two Instances opened When opening application from dynamicaLink and from launcher icon?

I ran into an issue in my Android Application where whenever I open my app through a dynamic link shared on Whatsapp, it will open in the same Whatsapp Application. I can see by going to the recent task that there is only one Application in a recent task which is Whatsapp and I can see my application inside it.
If I open my app from launcher icon then it will also create a new Application and there will be two application in recent tasks. My Splashscreen looks like this -
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You should added attribute in your activity
android:launchMode="singleTask"
In general it is better to use a dedicated Activity for sharing from other applications. Another app should not launch your main (root) Activity to share, it should launch a different Activity. That Activity can then launch your main (root) Activity in a new task (if necessary). You need to consider the user's behaviour and make sure that you don't confuse the user with multiple tasks.

Changing Mainactivity in Android

In iOS it is very use (when using storyboard) to change root view controller.
Root view controller; Controller that loads/appears to user when user first opens the app.
Is there a way to do that in android. I have an activity (e.g. RegistrationActivity) and I want that activity to be first activity that gets loaded in android
I can go to RegistrationActivity by following a flow, but for purposes of debugging I want to short circuit thsoe steps and want my emulator to load that activity on app launch.
You will notice that within the AndroidManifest.xml the MainActivty declaration has the intent filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Simply move this to which ever activity you desire to be the root activity

Why it is showing two apk files when running the app on a device

I have created an app ,for showing the users current location in the startup and another activity for enter a destination,i have used Maps activity for displaying current location,and a intent is passed to another activity when a button is clicked.The problem is it is showing two apk files in the device one for maps activity and another for second activity and when i create a signed apk,the maps activity was not showing nothing ?How can i solve this issue??
I had this issue too. Have a look at the manifest and check if you have multiple rows in the whole manifest containing the
"android.intent.category.LAUNCHER"
In case yes: remove the ones that are not related to the main activity.
The correct template, that is ONLY for the main activity, is the following:
<activity android:name="MainActivity">
<!-- This activity is the main entry, should appear in app launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Change Android App starting activity

I'm trying to change the start up activity.
I created an activity when the app loads but I want to add a screen before that, I'm not sure where to change the Android manifest to load a certain layout/activity when the app starts.
The startup activity [Launcher Activity] is declared in the projects' AndroidManifest.xml file
Look for that activity tag in the manifest which looks like this
<activity android:name=".Main"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Look at the attribute android:name. Main is the class which is launched when the app starts. Currently your calendar activity name should be there. Change that to the .classpath of your activity that you want to launch.
That should do it. You may also want to do the hello world application in the tutorials and go through the docs a little to see how Android Applications work.
From here
Just create another activity and set it as Launcher Activity and after a timer (if that's your achieve) just call the other activity!

Android Manifest

I found a code on internet for displaying a splash screen before starting an android application. He made some changes in the code which he didn't explain well.
He used Launcher for Splash screen Activity and used Default in main android Activity.
He used Package name with main class name instead of pre-generated code for android:name in action.
Here is the code.
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StartingPoint"
android:label="#string/title_activity_starting_point" >
<intent-filter>
<action android:name="com.alfred.splashscreenwithsound.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
So my question
What is the difference between LAUNCHER & DEFAULT.
Is there any good behind changing the android:name in action to the package name.
when you write LAUNCHER it will launch application with Icon and if you remove it it will not show you the application Icon
"android.intent.category.LAUNCHER" serves as our main entry into the app.
android.intent.category.DEFAULT be set if the Activity should be an option for the default action (center press) to perform on a piece of data.
Refer this
LAUNCHER is your main page DEFAULT is your Activity page when load the app. on device first LAUNCHER will open. Then If you trigger your activity page DEFAULT will open.

Categories

Resources