Application is not displayed in recent apps lists - android

My application is never shown in the RECENT APPS list whenever I put the following piece of code in my activity's manifest entry
<category android:name="android.intent.category.DEFAULT" />
If I remove above line it works fine. I've also made sure that the following flags are set to false-
android:noHistory="false"
android:excludeFromRecents="false"
But still its never displayed even if I launch app manually.
In case anybody wants to have a look the manifest, its-
<?xml version="1.0" encoding="UTF-8"?>
<uses-sdk android:minSdkVersion="8" />
<application
android:name="com.raj.poc.copypaste.MainApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".CopyPasteActivity"
android:launchMode="singleTop"
android:noHistory="false"
android:excludeFromRecents="false"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEARCH_LONG_PRESS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>

It may also happen if you set
<activity... android:label=""/>
for your main Activity

This is the only activity in your application, right?
You are using the category tag twice. You have written in your code
<category android:name="android.intent.category.LAUNCHER" />
so you have already selected the category. When you add a new activity then you will write the Default category tag.

Related

App launcher to reload from beginning in Android

I have created app to act like an home launcher. So when user clicks on the home button I get Complete action using Launcher or my app's name say for example "myhomelauncher".
When I click on home button and click myhomelauncher my application loads everything from first perfectly fine. Now when I am in the second screen in my application say I am looking at activity 2 in my app and now I click on Home button and click myhomelauncher I endup getting the same activity 2 windows it is not reloading. (It should reload and show up activity 1 rather than 2)
I have seen lot of apps that can reload everytime I click their launcher. Why not mine?
Here is what I have done in my manifest.xml
<activity
android:name=".MyLauncher"
android:label="#string/app_name"
android:persistent="true"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I am not sure where is the mistake?
Please have a look into the documentation - what can be of interest to your problem are the following settings:
android:clearTaskOnLaunch
android:launchMode
I would suspect setting android:launchMode to singleTask could solve your problem, altough be careful which side effects this will cause.
So:
<activity
android:name=".MyLauncher"
android:label="#string/app_name"
android:persistent="true"
android:screenOrientation="landscape"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
should do the trick.
Look up launchMode. But be careful, with great power, comes great responsibility.
This is the relevant section in a menifest that seems to work for me. Note that I have put singleInstance in the launch mode because I don't want more than one of my app, ever.
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".usbEffects"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden"
android:screenOrientation="portrait"
android:launchMode="singleInstance"
android:configChanges="keyboardHidden|orientation"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Android first app, all activities visible in menu

I just created my first Android app, all works fine, but all of the activities are shown on my Android menu. What did I do wrong?
Screenshot: imgur.com/9CmXU
I want to have one icon, directing to MainActivity, not all activities
<!-- language-all: lang-html -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myApps.birthdaymeter"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/my_logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".BirthdayMeter"
android:label="#string/title_activity_birthday_meter" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AboutWindow"
android:label="#string/title_activity_about_window" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ShowResult"
android:label="#string/title_activity_show_result" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is my manifest, changing logo didn't help
The <intent-filter> tag is used to describe the type of Intents that each Activity will respond to. The "android.intent.action.MAIN" action says that this Activity is an entrance point for your Application (think the main method that a java program requires). The "android.intent.category.LAUNCHER" category tells the OS to display the Activity in your list of Applications. Adding the DEFAULT category is ok, but effectively the same as omitting the <intent-filter> tag completely (which I find to make for much cleaner and easier to read code). You should only be using the <intent-filter> tag with these two actions and categories on the Activity that starts when a user opens your app. If wanted an Activity within your application to be able to respond to some special intents, you would use the tag to define which it responds to.
Here's a link to the google dev pages to help you learn more about Intent Filters.
http://developer.android.com/guide/components/intents-filters.html
Here's the documentation for the <intent-filter> tag. It's not the easiest to understand though.
http://developer.android.com/guide/topics/manifest/intent-filter-element.html
And here's the docs for the Manifest file and the Intent class. Both of these are good for reference if you're not sure about which tags to use in your Manifest. Good luck!
http://developer.android.com/guide/topics/manifest/manifest-intro.html
http://developer.android.com/reference/android/content/Intent.html
You phrased your question extremely generally, so I am not sure what to answer. It seems like you haven't called nameOfActivity.this.finish() when you launched another activity
If you post your manifest file I can help a little more, but it looks to me like you have not declared your activities correctly.
It should be setup somewhat like this:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="Activity1"></activity>
<activity android:name="Activity2"></activity>
<activity android:name="Activity3"></activity>
</application>
Essentially, create an application declaration, and then include each activity within it.

Android app installs but doesn't show up in app tray

I'm building a time logging application and i have created the main layout.
I tried to debug my application on my phone Samsung Galaxy S and it starts fine, but if i close it and want to run it again it's not in my app drawer. It shows up in Settings->Programs->Manage and in Recent when holding down the home button.
Here is the manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.doweb.timelog" android:versionCode="1">
<application android:icon="#drawable/icon" android:label="#string/app_name" android:theme="#android:style/Theme.NoTitleBar">
<activity android:name="MainActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN">
<category android:name="android.intent.category.LAUNCHER">
</category></action></intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8">
</uses-sdk>
</manifest>
I think your closing </action> tag in the intent-filter is in the wrong position.
Should look like:
<intent-filter>
<action android:name="android.intent.action.MAIN" > </action>
<category android:name="android.intent.category.LAUNCHER"> </category>
</intent-filter>
That filter is a signal to the system that this activity should be visible in the app-drawer. When it's not correct or present, the activity won't be visible.
Usually it's best to use closed empty elements to prevent this error:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You're also missing a . in front of your activitys class. This always relates to your apps package name. It will internally be joined to packagename + classname. Therefore the dot, otherwise it would result in com.doweb.timelogMainActivity, which is obviously not the correct reference. So it should be android:name=".MainActivity".
your activity's name like this android:name=".MainActivity", you can have a try

What does it mean "No Launcher activity found!"

I am writing a simple program of Android, and getting these no errors, I don't know what they are. My program is right, but showing not output.
I think it is because of these two lines:
[2005-01-06 19:56:38 - my_Android] No Launcher activity found!
[2005-01-06 19:56:38 - my_Android] The launch will only sync the application package on the device!
Here's an example from AndroidManifest.xml. You need to specify the MAIN and LAUNCHER in the intent filter for the activity you want to start on launch
<application android:label="#string/app_name" android:icon="#drawable/icon">
<activity android:name="ExampleActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Multiple action tags in a single intent-filter tag will also cause the same error.
Like Gusdor said above, "Multiple action tags in a single intent-filter tag will also cause the same error." (Give him the credit! I could just kiss Gusdor for this!)
I didn't find any docs for this fact!
I had added a new (USB) action and being clever, I lumped it in the same intent-filter. And it broke the launch.
Like Gusdor said, one intent filter, one action!
Apparently each action should go in its own intent filter.
It should look like this...
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
When I did this, WAZOO! it worked!
Do you have an activity set up the be the launched activity when the application starts?
This is done in your Manifest.xml file, something like:
<activity android:name=".Main" android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Check your manifest.xml. Make sure you have the category LAUNCHER there.
<activity android:name=".myActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
It means you didn't specify an Activity for Android to launch as the default when the app opens from the launcher. You have to add an Intent Filter in the Manifest for the Activity you would like to act as the default when the app is being launched.
Read http://developer.android.com/guide/topics/intents/intents-filters.html#ccases for more details.
I fixed the problem by adding activity block in the application tag. I created the project using wizard, I don't know why my AdroidManifest.xml file was not containing application block? I added the application block:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".ToDoListActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
And I get the desired output on the emulator.
As has been pointed out, this error is likely caused by a missing or incorrect intent-filter.
I would just like to add that this error also shows up if you set android:exported="false" on your launcher activity (in the manifest).
I had this same problem and it turns out I had a '\' instead of a '/' in the xml tag. It still gave the same error but just due to a syntax problem.
If you are using the standard eclipse IDE provided by google for Android development, you can check the "Launcher Activity" check-box while creating a new Activity. Please find below:
In Eclipse when can do this:
But it is preferable make the corresponding changes inside the Android manifest file.
You missed in specifying the intent filter elements in your manifest file.Manifest file is:
<application android:label="#string/app_name" android:icon="#drawable/icon">
<activity android:name="Your Activity Name"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Add and check this correctly. Hope this will help..
Manifest is case sensitive, so please compare this lines for any case mismatch especially the word MAIN in:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
You can add launcher to activity in eclipse manifest visual editor:
MAIN will decide the first activity that will used when the application will start.
Launcher will add application in the application dashboard.
If you have them already and you are still getting the error message but maybe its because you might be using more than more category or action in an intent-filter. In an intent filter there can only be one such tag. To add another category, put it in another intent filter, like the following
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!--
TODO - Add necessary intent filter information so that this
Activity will accept Intents with the
action "android.intent.action.VIEW" and with an "http"
schemed URL
-->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
just add this to your aplication tag in AndroidManifest.xml file
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
and also edit the uses-sdk tag from android:targetSdkVersion="16" to 17
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
You have not included Launcher intent filter in activity you want to appear first, so it does not know which activity to start when application launches, for this tell the system by including launcher filter intent in manifest.xml

android multiple activity declaration in manifest

I have a main activity. From it, I am calling 2 other sub activities called FacebookLogin and Twitterlogin. I am using the following code in AndroidManufest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.examples.Kikin" android:versionCode="1"
android:versionName="1.0">
<!-- THIS IS THE BEGINNING OF SHARING LINKS FROM THE BROWSER -->
<application android:icon="#drawable/kikinlogo"
android:label="#string/app_name" android:debuggable="true">
<activity android:name=".Kikin" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name=".FacebookLogin" android:label="#string/app_name">
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<!-- <data android:mimeType="image/png" /> -->
</intent-filter>
</activity>
<activity android:name=".TwitterLogin" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="yourapp" android:host="twitt"></data>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
Am i doing it right?
Should i nest the FacebookLogin and TwitterLogin activities in the main activity?
The aforesaid 2 classes are in the package com.examples..
* is the same wherever used.
The labels for your FacebookLogin and TwitterLogin appear to be missing an '#' - change them to android:label="#string/app_name"
There's no such thing as a "subactvity". Just because you call one activity from another doesn't mean it's a "subactivity".
You can't nest activity tags in the manifest and you'd probably get a compile error if you tried.
in manifest you can set only one activity in launcher tag okay android does support multiple launcher activity.
The manifest you posted looked fine.
But regarding your comment about the error message "Have you declared this activity in AndroidManifest.xml?", you need to check carefully the package and class name of the Activity you are trying to launch, and make sure that it matches the <activity android:name> you have written in the manifest.
All the info you need should be in the error message.
Don't nest activity declarations, just have them all as elements in your application element:
<manifest ...
<application ...
<activity ...
</activity>
<activity ...
</activity>
<activity ...
</activity>
</application>
</manifest>
The sample you posted here (indenting aside) looks fine.
Maybe you have tested it already but just try declaring your activities with the full path (although you have already declared it in the package tag). So, instead of using
<activity android:name=".TwitterLogin" />
use
<activity android:name="com.examples.Kikin.TwitterLogin" />
Sometimes problems are caused because of that.
I know this is an old thread but Im having the same problem and in my case specifying full package name doesnt help. Have you already found a solution? I`m really interested in knowing how to avoid this error.

Categories

Resources