I'm working on an Android application, and I want it to get started right after the phone boots up. I used BroadcastReceiver, and the intent filter boot up complete, and the permission, and I think it's working; I turn on the phone, it boots up, and then it shows the main menu, and after 30 seconds or so, my app starts. Is that the normal behaviour for it? I would like it to start right away, without even showing the main menu first. Is that possible? or is this the best i can get? I didn't find anything about this issue in google, and I'm relatively new to Android so I'm not sure if that's the normal behaviour or not. Hope you can help me, thanks.
It sounds like what you are looking for is a Service. It will run in the background and can be set to auto start. I'm not sure that it necessarily come up faster than your activity does, but I think it will. Check these documents: http://developer.android.com/guide/components/services.html
Related
According to the android documentation (https://developer.android.com/guide/components/activities/background-starts) this shouldn´t even be "possible" anymore. I checked many posts already but they all seem too old or say this isn´t really feasible or easily doable anymore. But still, there are apps doing this today like (StayFree for example). I want to start the activity with a running service that checks data in the background.
What I would like to know or I think is needed:
Permission like display over other apps (Something like ACTION_MANAGE_OVERLAY_PERMISSION)
A service for which is running in the background while the app is not open and starts the activity from the background.
Attention: I want the overlay/activity to be a normal activity and not a system alert window.
I tried many things but I am still mainly a C# Dev so help I would appreciate your help thanks!
I learned that following is Overview screen.
I clicked the dialer and dialed a number and then swiped the dialer to the right.
But still the call is on like this.
How is this done?
I am a newbie to Android programming. I am thinking if they had used a back ground thread or a separate service or something else, so that it is never killed accidentally. How is this done?
Please help me. Thanks.
I believe it is using the Android foreground service. You can checkout how to run it in the doc:
https://developer.android.com/guide/components/services.html#Foreground
The difference of foreground from background service is when phone is low on memory, system will not automatically close it to release memory, it should be closed manually by user, which is why you need to have a notification as a way for user to close it when you first create it.
i am currently collecting information, if it is possible to make some kind of quickdraw-application for emergency purposes; i want to get the device to start a customized camera-intent once some certain key-combo is pressed.
I have check quite some information on the topic already, but it is still not clear to me how doable this whole idea is.
So far i figured, that it is not meant to be by android-design. My first idea was to build some kind of InputService and make it teach the hard power-button to listen for a triple-click. But the Services arent allowed to catch KeyEvents. So, the volume-button is out of the equasion aswell.
Then i came across the idea reacting on the SCREEN ON/OFF event, but 80% of the ppl say that it is not going to work, while 20% state, that they got it. But im not really sure if they really did it.
Last but not least the question, if it is possible to launch this customized-camera-intent/application out of the locked mode.
resumé: i need to check if its possible in general to launch this camera-app (that does some quick fotos for emergency purposes) while phone is in the pocket in lock-mode. Anybody got some opinion for me? thx
The solution is to setup a BroadcastReceiver that is listening for the SCREEN_ON-Event. I did this one inside a backgroundservice that was waiting for at least two SCREEN_ON-Events within a short period of time. (less than two events obviously can't work)...
The Service then dismissed the Keyguard and was able to even pass past password/gesture and run the App. Funny fact: closing the app does pop back to desktop still beeing logged in.
I did this at Android 4.2.. Sources told me that dismissing the keyguard is not working with current Android-versions no more.
After 3.1 , Android introduced a security feature, where the application's code can't be run unless the user opens the application. Check the link for more info http://commonsware.com/blog/2011/07/13/boot-completed-regression-confirmed.html
I would like to know if anyone has found any hack or work around for this problem, where i can listen to a system broadcasts like boot, connectivity changed and run a service without opening the installed application.
This is not what the posts said. You can still register broadcast listeners, or alarms. You just need the user to actually start your application once. And, if the user forcefully stops your application, they'll need to start it manually again.
Why would you want a way around this behavior? It seems to make a lot of sense.
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