java - Can I launch an activity from boot-up and have it go into the background without the user seeing it, android -
I currently have a code that starts an application with boot-up but opens it in the foreground
Public vacuum on receiver (reference reference, intended intent) {if ("android.intent.action.BOOT_COMPLETED" .equals (intent.getAction ()) was done by {intent start = new intent (Context, upollomobile activity category); start.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity (start); Then to send it back in the background on a I created the Java file called StartAtBootService, so I changed the receiver class to:
if (Intent.getAction (.) Equal (Intent.ACTION_BOOT_COMPLETED)) {intent I = new Intent (); i.setAction ("com.example.ssab.StartAtBootService"); context.startService (i);} and service class
Public Class StartAtBootService Service Enhances {Public IBinder onBind (intent to intent) {Return Null;} @ Override Public Wide On Create () {Log. V ("StartServiceAtboot", "StartAtBootService created"); } @ Override Public Start Start Commands (Intent Intent, Int Flags, Entit Start ID) {Log. V ("StartShareBoot", "StartAutBoot Service - Onstart Commands ()"); // We want this service to continue until it is explicitly closed // Therefore, return sticky back. Return START_STICKY; } / * * Android 2.0 and later, onStart () has decreased. Instead use * onStartCommand (), or compile against API Level 5 and use both *. * Http://android-developers.blogspot.com/2010/02/service-api-changes-starting-with.html @ Start (intention intent, integer start-up) override public at zero {log. V ("StartServiceAtboot", "StartAtBootService - OnStart ()"); } * / @ Override public void to Desto () {log. V ("StartServiceAtboot", "StartAtBootService Deleted"); }} Is it possible to change StartAtBootService to play an activity in another Java file called Apollomobile Attrivity in the background? I have tested this code and even if it runs in the background on boot-up, but this code has not been run in Apollomobile Attachti.
Please help! Thanks guys :)
An activity is an application component which provides a screen with which users can interact with something, such as dial a phone, take a photo, send an email, or view a map. Each activity is given a window in which to draw your user interface The window usually fills the screen, but the screen can float on top of the smaller and other windows. to You can start an activity, but there is no such thing as an invisible activity. These are UI components if you want to do invisible work in the background, then you have to do it in your service.
Comments
Post a Comment