HOME activity will not show up or act as home activity - android

This is my first time asking a question on on here, but I have found the answer to innumerable questions I've had before on here. However, I just can't make this one work. I'm simply trying to write an app to replace the homescreen. Here is what I am trying, and I can't see what I'm missing.
To keep it as simple as possible, I reduced it to just this testing application. The only thing I changed after starting a new project was the manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hometesting"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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" />
</intent-filter>
</activity>
<activity
android:name=".HomeActivity"
android:theme="#style/AppTheme"
android:launchMode="singleTop"
android:stateNotNeeded="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.categoty.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
I have tried it both in the emulator and my own phone, in the latter, it doesn't show up in the chooser. I can select it as the default home application in the user settings, but when i hit the home button, it just brings up the chooser without my app as an option. The pre-installed home screens and one other app that I downloaded show up as options, but my app doesn't. In the emulator, a click on the home button just brings up the default homescreen.
I have tried it with and without the separate launcher activity, and with and without the LAUNCHER intent. I have tried installing, uninstalling, restarting, and every permutation thereof.
All I want is for the home button to lead back to an activity that I wrote. Any help would be greatly appreciated.
Update: I also tried it on a generic cheap Chinese device, and still nothing.

Related

Set Android phone for ShowRoom

We, my company, are facing a problem. We have a phone in public use where we can't be always near the phone. It's a show room where public user can test our Android app.
The problem is :
1) Can we block the phone in our app ? we just pin it but it doesn't block the phone. We found some apps the make something like that but not good results
2) A test user just add a security password to lock the phone. So now, we can't unlock the phone. We need to forbid user to add a lock password but we don't want to add one because if the phone is sleeping, a user should be able to unlock it.
**Edit : ** We can't block user from accessing settings
So, is there a solution for that ? like a "ShowRoom" mod ?
If you need more precisions, please ask.
Thanks
First you need to add the following attribute to your activity:
android:launchMode="singleTask"
Then add two categories to the intent filter :
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
The result could look something like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dummy.app"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.dummy.app.MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>
</manifest>
please read this answer to block exiting app
https://stackoverflow.com/a/16333555/5223973
if you want to use any third party app to lock your app you can use any
android parental control apps

Android - Launcher Activity showing for one second

so, I have a little problem, while opening my app.
I have an "ugly" popup opening for 1-2 sec and then my app goes in.
How exactly can I open my app directly without that 2 sec empty page?
btw - I changed the string of the android:name of my launcher activity to verify that it is this exact activity that is opening empty, and the name changed in the actionbar so it is this activity.
the picture of the first and "ugly" screen
<---
here's my manifest code :
<application
android:name=".BaseApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light.NoActionBar" >
<activity
android:name=".UI.activity.HomeActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:launchMode='singleTask'
android:theme="#style/Theme.MyAppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
anyone had this kind of problem before?
thanks a lot.
if anyone ever experience this kind of issue like me,
the solution for me was changing the theme of the app to
android:theme="#android:style/Theme.Holo.Light.NoActionBar"
thank you Kesh for relating that question!

Missing App Title under App Icon on Device

I have installed the Android App on which I am currently working on my ASUS tablet, running 4.0.3
However, I must have accidentally deleted something in the Manifest.xml, because there is no words below the app icon. In other words, the app name is not appearing below the app icon on my device, and, as such, it is sorted in the All Apps screen in the wrong place.
Here is the relevant section of my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tra.games.mytaboo"
android:versionCode="1"
android:versionName="1.2.1" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="Taboo"
android:theme="#style/AppTheme" >
.....
What am I missing?
Tim, Label of your launcher activity will be displayed.
<activity
android:label="Taboo"
android:icon="#drawable/icon"
android:name=".activity.LaunchrActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
</activity>
http://developer.android.com/guide/topics/manifest/activity-element.html#label
<activity
android:label="Your Name" <---- here name!
android:icon="#drawable/icon"
android:name=".activity.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
</activity>
You could call the setTitle() function from within your Activity. It takes either an int (resource ID) or a CharSequence as a parameter.
You have missed android:label property. which is set your application name under the icon
android:label="#string/app_name"
Here I have set to load app name from string.xml file.
You can set it directly like this too
android:label="app name"

Widgets not showing in Android 4.0+

I have a basic clock widget here, it works just fine on versions of android below 4.0, you can long press, select widgets and its right there. But when i try to run it on 4.0 or later emulator or real device, it does not show up in widgets section only in Settings>Storage>Apps. I have tried adding a simple activity that just gives users directions on how to install the widget , that suggestion was given as an answer here: Android 4.0: widgets not appearing? . Unless i did it wrong the widget still does not show up in widget drawer.
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.widgetexample1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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" />
</intent-filter>
</activity>
<receiver android:name=".ExampleAppWidgetProvider"
android:label="8-bit cloud widget 1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/widget1_info" />
</receiver>
</application>
</manifest>
add below in your manifest.xml.
"android:exported="true".
it might help.
try it.
In your widget metadata xml file check tag <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:xmlns attribute should start with http://.
It looks like you are being hit by a security upgrade which I think happened in HoneyComb.
Basically, in newer versions of Android, you cannot have your widget working, without first launching an Activity.
So add an activity to the project, run it first, and I think your widgets will update.
A good example would be to use a Settings style activity, or perhaps and About box type of thing, to tell the user a bit about your widget. (I use settings in my widgets).
For more info:
Android 4.0: widgets not appearing?

Android app always opens the first activity on resuming

I'm working on an application that currently has two activites, a log in activity and a "frontpage" activity after that.
Whenever I switch away from the application and resume it either by relaunching it or using the application switcher, it will always re-open the log in activity. Even if I switch to my app from within the frontpage activity, it opens the log in activity.
None of my other apps have ever done this, even though they obviously all have a filter for the launcher in AndroidManifest.xml. I am aware that it is supposed to do this when the activity is killed, but I cannot comprehend why it would do that.
This is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="nl.vertinode.facepunch"
android:versionCode="1"
android:versionName="1.0">
<!-- Android 2.2 -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<!-- Internet access -->
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name" android:name=".FPApp">
<!-- Login form -->
<activity android:name="nl.vertinode.facepunch.LoginActivity" android:launchMode="singleTask" android:theme="#android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Frontpage view -->
<activity android:name="nl.vertinode.facepunch.FrontpageActivity" android:theme="#android:style/Theme.Light.NoTitleBar" android:windowSoftInputMode="stateHidden">
</activity>
</application>
</manifest>
What could I be doing wrong?
I'm going to guess this has to do with your android:launchMode being singleTask.
Try singleTop instead and see if you have the same problem. Also it could have to do with some code you have in your onPause for the other activities. Does it go back to your Login activity after going to sleep/waking back up as well?

Categories

Resources