Can we create an apk without an user interface in android - android

I want to create an apk, without an user interface in android. And I need to start a Service as soon as the Applicaton gets installed on the Device. Is there any possible way to create an apk without UI.
Thanks in advance.

And I need to start a Service as soon as the Applicaton gets installed on the Device.
Fortunately, that is not possible for an app installed through normal channels (e.g., the Play Store), for security reasons, since Android 3.1. Nothing of your app will run until something on the device uses an explicit Intent to start up one of your components, and that most certainly does not occur when your app is installed.
You are welcome to build your hardware, or your own custom ROM, that has your app pre-installed. In that case, you can arrange to be able to run right away.

yes, you have juste to create a Service or a BrodcastReceiver which do something you want

Related

Android- programmatically restrict which apps can be run

I'm building an app that needs to restrict which apps can be run along with it.
In example, when my app is running (foreground or background) I can allow user to run only GoogleMaps, and MusicPlayer.
I've read a bit about Device Policy Controller and creating profiles, and up to some point it seems to have the feature I need, but it is designed for enterprise deployment, and user needs to encrypt their phone beforehand. Is creating personalized profiles a way to go?
My other idea was to run a service that each few milliseconds check if there is any forbidden app running and finish it, but it seems to be not robust.
Is there any way of handling this problem programmatically?
I don't think that Device Policy Controller is a right thing for you.
And you can't just kill other apps without root.
So some kind of user-friendly way to achieve the goal is to check running apps list with ActivityManager.getRunningAppProcesses and to notify user that he has to finish particular apps to use your app.

Android: launch any activity to start in the background?

If I'm writing my own Android app, I know how to structure it as a Service so it will start running in the background.
However, is there a way to launch an existing app (for example, any random .apk from the Play Store) so that it starts up in the background, without its screen taking over the display?
Alternatively, I'd be willing to launch the app, force it into the background, and redisplay the window of the previous app (whatever it might have been) that was running in the foreground. I don't know how to programmatically put the current app in the background and then determine the previous app and bring it back to the foreground.
I'm willing to do this any way possible: via Java, via one or more command-line utilities, via a Tasker plugin, via an Xposed module, or whatever.
Thank you in advance for any pointers to docs or any suggestions.
I discovered that the #0 entry of "dumpsys activity recents" gives the currently displayed activity ... at least on my rooted Marshmallow device. This gives me what I need.

Restrict android phone to just install just my application

I am building a android application and I want to run this application in such a way that once it is installed in a device, that particular device should not be allowed to install any other applications. Basically restrict app installation to just one application(i.e mine).
I have looked at few options such a home launcher and tried but this allows me to install other applications as well. Is there a methodology where I can block other apps from getting installed in my device? Thank you.
You should take a look at this page:
http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_ADDED
When a package has been installed, you should receive a new broadcast event with this intent.
Basically, you have to force uninstall or lock the app with that package id. You'll probably need to be root on the device if you want to avoid a new activity to show up.

android create system service

Do android have anything like system service? Windows have services, similar. I want to create a application similar to antivirus which should run as system service and other programs should not be able remove it not other programs should be able to modify/ delete its data.
You can create a service based app and install it.
User will be able to install/uninstall as per his wish..
This service can be started as soon as the phone is started with
API's available.
Each app has its own space/memory for it use and it cannot be accessed by other apps unless given permission.
Actually you can create a system service, but you need to modify system image for this. If you can do this you can start it at the init.rc file or SystemServer.java. But for my point of view, Vinay is right - you should make an application with service. The application cannot be uninstalled by other applications, and the data of the application by default cannot be accessed by other applications (each application has its own user id. After that Android apply standard linux file permissions to the files of the applications).

Android application update - how to?

What is the best way to let my users perform an application update?
Is there any way to force device reboot after the update? I'm asking this because my application registers some behavior on boot.
Please note, the application would not be published in the Market.
Update:
My app will be preinstalled on a set of ~100 handsets.
Should I periodically call a webservice that will inform the device about upgrade available, and then, redirect to an .apk file within a webkit view?
What is the best way to let my users
perform an application update?
Via the same way they got the app on their device in the first place, presumably. If they are getting the app via firmware, they get app updates via firmware updates. If they are downloading your app via your Web site, they get app updates via your Web site.
Is there any way to force device
reboot after the update?
No, thank goodness.
I'm asking this because my application
registers some behavior on boot.
There is some way you can be notified that your package was updated, though I do not have the technique handy right now. Just run your on-boot logic there for the first round, then subsequent reboots (if any) will be handled by the on-boot logic itself.

Categories

Resources