1

I'm making an Android app and I would like to know how to hide its icon and title from showing in the menu. Everything I've found so far on the internet is hiding

<category android:name="android.intent.category.LAUNCHER" /> 

in AndroidManifest.xml.

If I do that it doesn't start after installation! Another important note: I need my app to ALWAYS be running, even after restarting the phone.

Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
Ljubisa Livac
  • 819
  • 3
  • 13
  • 38

3 Answers3

5

but if i do that i can't start my app after installation!

Correct. Effectively, as of Android 3.1, you must have a launcher icon, at least at the outset.

i need my application to be ALWAYS turned on, even after restarting the phone (turning it off and on).

I have no idea what "ALWAYS turned on" means in terms of an application. I am going to assume you mean "ALWAYS running".

In that case, this is not possible. Users can and will stop your app by any number of means, such as task killers and the force-stop option in Settings. The Android OS will automatically stop your app if it is hiding in the background for too long. It is considered poor form to have some piece of your application (a service) running constantly -- very few applications need this.

Moreover, please bear in mind that the combination of "I need it always running" and "I do not want it to appear in the launcher" sounds very suspicious, almost as if you are trying to write something that the user might not want to have running.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Sorry, you are right, i meant ''always running''. I'm writing this app only for my needs so it won't be published. Having that in mind i'm not concerning about security or some other aspects :) this app is only for me. Anyway, assuming that user won't use task killers or force it to stop, how can i make it to be always running? I have AlarmDroid for example in my app manager always running, although i don't have anly alarms turned on. – Ljubisa Livac Jan 10 '12 at 13:43
  • 1
    @Adam: AlarmDroid probably is not always running. Hopefully, they are using `AlarmManager` to get control at the times of your alarms. – CommonsWare Jan 10 '12 at 17:39
0

Then you would need some way to start a service. Or figure out a meaningful way you can actually start up your application without user interaction, there are tons of options.

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
  • I'm trying to find out some way, but I started doing in Android SDK three days ago and it's really hard for me, can you give me some link or something, where i could find some solution? – Ljubisa Livac Jan 10 '12 at 13:21
  • Read the documentation here: http://developer.android.com/reference/android/content/BroadcastReceiver.html – JoxTraex Jan 10 '12 at 13:24
0

There are lots of Intent defines for receiving broadcasts through which you can start you activity for example

  • ACTION_BOOT_COMPLETED
  • ACTION_POWER_CONNECTED

for further detail check this link

rajpara
  • 5,203
  • 1
  • 29
  • 46
  • None of those will work, as of Android 3.1, until the user has manually launched an activity. – CommonsWare Jan 10 '12 at 13:32
  • @CommonsWare : yes, thats right, i read this over just now, why android putting restriction, i am afraid that Android is on the way of iOS. – rajpara Jan 11 '12 at 06:12