Background application without ui - android

I am new to android development. I want to make one background application, so that it keeps running in background, and it's without any UI, and even its icon do not appear on desktop.
In short it's a stealth application.
Is it possible?

This is certainly possible. To create an app that does not have an icon in the launch pad, just remove the Activity with the android.intent.category.LAUNCHER category from the AndroidManifest.xml.
To implement your background application it strongly depends on what you want to do. You can create a Service for long running tasks, BroadcastReceivers to react to specific events or Activities with intent filters.
Be aware, however, that your application will be visible in both the file system and in the settings under 'Manage Applications'.

Yeah it's possible look up Service
Read more about the service in tutorials
ServicesDemo - Using Android Services
How Android Services Work
Android Service creation and consumption

Related

Android Oreo: Is there any way to auto - start the application on mobile reboot?

I am developing an application for a business entity. That application should run in the background in every employees' mobile phone. Employees are mostly salesman. The application basically detects location changes and suggest the salesman where they might visit. A kind of reminder application. It also lets other salesmen see where are their teammates.
Right now I am using a foreground activity and it works fine till the system forcefully doesn't kill the service or the phone doesn't reboot due to manual activity or battery discharge.
Ones the application is closed, as of now, the managers in the firm needs to call salespeople to turn on the application once, as on application start it automatically turn on its foreground service. But this is really an extra burden on the management team which can be automated.
I am ok to have any settings based or code based solution. One solution is to root the phones of salespeople and install some extra utility app or write the code based on root APIs, but this will be too much for this simple task.
THe permission RECEIVE_BOOT_COMPLETED was not added properly in the manifest. After adding the permission it worked calmly. In on receive method of the broadcast receiver, I am starting the foreground service.
At the moment, the best way is to use WorkManager https://developer.android.com/topic/libraries/architecture/workmanager/ Yes, it still alpha, but works very good.
From other side, you could work on automating the task "managers in the firm needs to call salespeople to turn on the application once". I mean, an app/backend could automatically call the salesman (with some pre-recorded message) or send SMS to them.

How to write a background service in Android?

The "service" here is different form one of the application components "service" in Android. I mean that people can not see the app icon in launcher, and, the can not see the app in the program manager in Android.
The most important is that I don't want the user notice the existence of the app.
Is that possible? Is it a "service" in Linux?
Without ROM modifications, you can't make a linux service. I will tell you what you CAN do.
First, your requirements
Not see the app icon in launcher: This can be done by simply not having an activity that supports the ACTION.MAIN and CATEGORY.LAUNCHER intents.
Not see the app in program manager: Unfortunately for you (but fortunately for all users) you can't get around this with a normal application.
Have a service run "all the time": The best you can do here is start a foreground service upon boot of the device. This will cause a notification to be in the users notification bar, but its really the best you can do on stock phones.

Android phone as a dedicated device

We want to use Android mobile for dedicated application. Can somebody suggest how can we make it happen.
Here are the requirement:
The phone when started, should launch our application., so the user cannot launch any other application. The application will be a 1D barcode reader.
The application should be live as long as the phone is up and running, user cannot close the application at all.
Thanks for your help.
Regards,
Manish
Android after boot is complete sends a bradcast intent:
android.intent.action.BOOT_COMPLETED
if you listen for this intent, you can launch a service that in turn launch your activity.
In the Activity you have to take care of the user's interactions that explicitly close the activity, like home button, back button and camera button press.
Setting your activity to be full-screen also should prevent the user to use the notification bar to interact with notification like those from market-app that can close your activity.
Finally, your activity can be killed by the system by various and uncatchable reasons: in those cases, the service that first launched your Activity comes in handy, as it can periodically monitor the general state of the application and relaunch components as needed.
Check out the new Android Enterprise solutions for your use case.
https://developers.google.com/android/work/overview
Its well documented. You can either use
Android Management API to provision the devices and apply policies to the device which will be applied to the device using Android's Device Policy Controller (DPC) or,
Use Google Play EMM API and develop your custom DPC
It depends upon your use-case really, but the first solution set should serve your purpose
I'm afraid there's no single answer to this, but you need to work on multiple fronts.
One of these fronts is preventing user from running other applications: for this there are applications sold on Android Market that can put other apps of your choosing behind passcode.
You need to combine this with automatic launch, but I don't yet know how to do that.

Android emulator, how can I control 2 applications simultaneously?

Is there any way of running 2 (or potentially more) applications on the emulator at the same time?
I have an application that obtains its data from another application, therefore I want to modify data in application A and then see how application B handles it.
I'm intending to have some kind of "slider" on application A, therefore I need them both to be running at the same time to see the "slider" on application B update.
You can't have UI threads of two applications running at the same time, but if one of your apps has a background service, that can be running while the UI thread of the other is active. This service could put a notification in the status bar to signify that the data has been updated (actually, I think it's now required that a background service have something in the status bar anyway).
I believe you can also create a "toast" pop-up notification from a background service.
If it's just for testing, your background service can also write messages to the logs which you can see with logcat.
You can use the emulator like a normal phone, so you can run as many apps at the same time as you want. When you say "running", are you talking about "debugging"? You can install any number of apps using adb install, or by just running it through Eclipse. Running a new app won't stop the previous one (besides, you can always go to the app menu and start your other app).

How to start android service on installation

I have a device management application, which essentially runs as a service in the background from boot. I'd like to start this application immediately after installation. How do I achieve this?
You cannot do this -- there is no way to automatically start your service merely because it was installed.
The application must first be invoked by the user through some sort of activity. Or, you are going to need to hook into some relevant broadcast Intent via the manifest, so you can get control when one of those events occur and kick off your service that way. Or, you are going to need to ask the user to reboot so your BOOT_COMPLETED Intent filter can get control.
There was a hole - the Android Analytics SDK used to send an intent right after installation - but that got closed (producing lots of confusion, of course).
But the final answer, I believe, is here:
http://developer.android.com/about/versions/android-3.1.html#launchcontrols
This seems to suggest that, as of 3.1, Google made the decision that apps are in a stopped state until the user explicitly activates them, e.g. by launching app or placing widget.
This means that the strategy of listening of a common broadcast (i.e. to get your app launched surreptitiously) won't work either.

Categories

Resources