Run app but not from launcher - android

I'm developing an android service application, which reacts on some intents. As you know, intents won't trigger until the app is launched for first time. Because my app is not interactive, I'd like it not to be shown in the launcher (app list). I can do this by removing
<category android:name="android.intent.category.LAUNCHER"/>
from the manifest file, but after that, how do I execute the app, as it is not shown anywhere? :|
Thanks.

What about disable the launcher icon after the application was launched the first time?
http://www.helloandroid.com/tutorials/removing-app-icon-launcher
Although this
the icon will only disapper when the launcher is restarted, so likely on next phone reboot, forcing the launcher to restart is not recommended"
doesn't sound good...

how do I execute the app, as it is not shown anywhere?
So you have to use BroadcastReceiver So similar topic where your can find similar solution. Check this

If your application is serviced based, responding to intents, why do you need to execute it? Won't the intents start your application?
Make sure you include the right intent filters in your manifest. Without them intents won't trigger your services.
http://developer.android.com/guide/topics/manifest/intent-filter-element.html

Related

Android Studio How to run application but it should not have launcher

I have an application which I simply want to run but it should not have launcher Icon.
I have deleted this tag
category android:name="android.intent.category.LAUNCHER" />
But then Android studio starts to give error that
Could not identify launch activity: Default Activity not found
Error while Launching activity
then I switched the run configuration as the following :
What I want :
I just want that My application start running once I run it from the android studio , but it must not have launcher icon . SO that user should not be able to launch it by himself.
Note:
I do know that it is not legal we should have activity so that user can se it , use it and change something if he wants. But that is not the case in my app as the user want himself to hide its launcher so that no body knows about app. So do not worry about such case. :)
I have an application which I simply want to run but it should not have launcher Icon.
Then your app will never run.
running service or broadcast receiver
Your app, once installed, is in a stopped state. None of your code will run until something uses an explicit Intent to start one of your components. Normally, that is the launcher icon. Other possibilities include if the user sets up an app widget, or if your app is a plugin for some other app (and that other app uses an explicit Intent to start one of your components). Outside of those scenarios, your app will never run. This is to help prevent malware.
the user want himself to hide its launcher so that no body knows about app
You will still need a launcher icon. However, when the user runs your app, you can use PackageManager and setComponentEnabledSetting() to disable that activity, so it will no longer show up in the launcher.

How to receive the Intent when an app starts

I know the android broadcasts an Intent to start an activity. I can use a Broadcast Receiver to receive that intent. But what is the actual way of receiving an intent if an app starts in Android as I don't know what can be the actual intent for an app be (Means I can get the list of installed android applications but how to know what intent will be broadcasted if a particular app starts) .
EDIT :
I'm just adding this as a feature in my phone that if a game launches, then the Immersive mode will automatically be opened. I've system priveleges as well (as I can make the changes in SystemUI or frameworks as well). I don't want to touch the Launcher though.
by this way . But it's still a little bit weird as solution . I don't think there's any simple way to do it...

Hiding App (or running in background) without using service

I am working on using the USB_DEVICE_ATTACHED intent on an app. The app works fine, but I would like to open it with another app to start using the device.
I'm wanting the app to launch either hidden or in the background (not launch on top of the already running app). I've seen some use services for this, but it looks like USB_DEVICE_ATTACHED (and the other usb intents/permissions) don't work on a service.
Have your broadcast receiver call the service when it receives that particular intent action and then start your service.
Update
Read the great link provided by CommonsWare:
http://developer.android.com/guide/topics/connectivity/usb/host.html
Ended up using an activity with the NoDisplay theme.

Start Android application without launcher

How to start an application that has no launcher activity?
Story behind the problem:
I have an application that is basically a BroadcastReceiver that waits for a couple system intents like BOOT_COMPLETED. The problem is that as my application has no Activity, it doesn't get started and so it receives no intent.
Android 3.1 release notes mention that intent options can be overridden to start up applications but I assume it requires another active application to do so.
P.S. Write all the ways you know. ADB commands as well.
First piece of advice would be to make a very simple "Welcome to my App" Activity that could be run. Use it to show a splash screen, some advertising, or be a settings screen. That gets you around the "no Activity" problem.
As far as I know, you cannot have anything hooking into BOOT_COMPLETED until and Activity in your application has been run. So you need to have an Activity of some sort.

How to hide application from showing in menu

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.
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.
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.
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

Categories

Resources