Android Intent Service to run in separate process does not stop itself

Android Intent Service to run in separate process does not stop itself

By : Una Uni
Date : November 22 2020, 02:42 PM
hop of those help? Android is essentially Linux based, so processes should be viewed always in that context. Now, the Service is provided by Android, but the sandbox is provided by Linux. Moreover, things get more complicated, because there is JAVA in picture as well, and a Virtual machine essentuates things more. stopSelf() by a service does in no way mean that the process containing the service is killed. To kill a process, you need to execute SIGKILL aka kill -9
So, even when Android has been signaled for stopSelf() by the service, Linux may still decide to keep the process alive, especially because before terminating a process, the resources need to be GCed. Thus, stopSelf() is in no manner equivalent to SIGKILL, which would essentially mean that you are not able to see the service in PS list (or Android's process list) immediately
code :

Share : facebook icon twitter icon
Process: Unable to start service com.google.android.gms.checkin.CheckinService with Intent

Process: Unable to start service com.google.android.gms.checkin.CheckinService with Intent

By : C.link
Date : March 29 2020, 07:55 AM
like below fixes the issue I tested it on an actual device and it was able to grab my current location. I wonder why the emulator does not function!
code :
private GoogleMap.OnMyLocationChangeListener myLocationChangeListener = new GoogleMap.OnMyLocationChangeListener() {
    public void onMyLocationChange(Location location) {
        //Do something when location changes
Android: Stop a handler at a certain time in an Intent Service

Android: Stop a handler at a certain time in an Intent Service

By : Brandon C Jones
Date : March 29 2020, 07:55 AM
I wish this helpful for you Start a new thread and wait. When time's up, stop and remove the runnable. Or use handler to post another delayed runnable to stop and remove the working runnable.
code :
    public class RedirectService extends IntentService {

    private Handler handler;
    private boolean mRun = false;
    private Runnable runnable = new Runnable() {
        public void run() {
            if (mRun) {
                handler.postDelayed(this, 2000);

    public LockedRedirectService() {

    protected void onHandleIntent(Intent redirectIntent) {
        // Gets data from the incoming Intent
        final int hour = redirectIntent.getIntExtra("hour", 0);
        final int min = redirectIntent.getIntExtra("minute", 0);

        mRun = true;
        handler.postDelayed(runnable, 2000);

        new Thread(new Runnable() {
            public void run() {
                try {
                    Thread.sleep((hour * 60 + min) * 60 * 1000);
                } catch (Exception ignore) {}
                mRun = false;

        /* or use handler
        handler.postDelayed(new Runnable() {
            public void run() {
                mRun = false;
        }, (hour * 60 + min) * 60 * 1000);

Android service in separate process

Android service in separate process

By : Cody M Beardsley
Date : March 29 2020, 07:55 AM
this will help Ok, I figured it out: When I swipe my application from recent apps, both processes (main and service) closed, then serivce restarted. I solved it by adding startForeground(R.string.app_name, new Notification()); in onCreate of my service (Can a service be killed by a task killer). all :)
Android stop Service using (Pending) Intent

Android stop Service using (Pending) Intent

By : Patrik.E
Date : March 29 2020, 07:55 AM
this one helps.
So what method gets called when I send this intent by pressing DEACTIVATE?
Notification FCM android java doesnt work Service took too long to process intent: com.google.android.c2dm.intent.RECEIV

Notification FCM android java doesnt work Service took too long to process intent: com.google.android.c2dm.intent.RECEIV

By : user3002649
Date : March 29 2020, 07:55 AM
will help you Work that takes more than 10 seconds is blocked by the Android core Foreground service should be used to fix the problem
this link can help
Related Posts Related Posts :
  • How can you animate a view back and forth between two states on Android, while supporting backpressure?
  • $(LOCAL_PATH) not returning the path to current directory correctly
  • Error:Cause: com.android.sdklib.repository.FullRevision
  • How to get an offset in RecyclerView ItemDecorator
  • Android toolbar home button not showing
  • TextView keeps popping up
  • Toolbar overlaps below status bar
  • Inflated view not updating
  • Errors of the Manifest
  • How to perform the same operation on several elements in array in doInBackground()
  • see error when use getSupportActionBar().setDisplayHomeAsUpEnabled(true)
  • What the heck is going on with this animation?
  • How to set the color of the counter on a TextInputLayout?
  • Cannot resolve symbol 'GeoJsonLayer '
  • Font file not loading on Libgdx Android
  • Simulate GCM push notifications on Android
  • Google maps provider, Wifi, 3g and GPS
  • Textview animation error
  • I want my FAB to stay at the bottom of the screen
  • How to attach multiple Images with a note taking app in android?
  • How to share xml layout using Intent.ACTION_SEND
  • Is there a default selector for the RecyclerView
  • Cordova SQLite Plugin not functioning with Android Studio
  • Android Load fragment when ListViewItem is clicked
  • gradlew build freezing at mergeDebugResources
  • Managing android's backstack
  • Realm.getInstance(context) not working anymore after Migration
  • How to achieve a similar horizontal scrolling widget like a custom seekbar?
  • Installing google analytics in Xamarin Studio for Android
  • Using PhoneGap and SQLite insert statement
  • Sqlite query to keep the last 5 searches on android
  • Picasso with paged ListView
  • Adding a fragment, a "wrong second argument type" error occurs
  • Cannot change dependencies of configuration (after enabling instant run)
  • How to bypass facebook login screen while integrating facebook to App
  • How does one create 2 buttons next to each other that are equal in width and height?
  • Android Studio 2.0 Preview upgrade problems
  • Android Imagery - Gallery scales
  • sqlite select query with foreign key for another table
  • android app installs but won't open on android 4.4
  • Error:Execution failed for task ':android:transformClassesAndResourcesWithProguardForRelease'
  • Android - Activity to Fragment exchange - ListAdapter
  • Putting your Application on sale
  • Show Toast on ScanContiniously
  • How the Spinner setSelection() works?
  • Supporting Android TV and reusing main activity
  • How to show the 3-dots menu without ActionBar?
  • Android change app icon
  • Android: How to draw on a Surfaceview which already is displaying a Camara Preview
  • NDK compiling error caused by __Atomic, when using RefBase or IBinder
  • Can't change container ID of fragment SupportMapFragment
  • Fehlermeldung: AndroidRuntime(20941): FATAL EXCEPTION: main
  • multiple addTextChangedListener for multiple edittext
  • NavigationView overlaps content
  • Laptop/Notebook PC for android
  • navigation drawer move between fragments
  • Android - get percentage of viewable rect
  • GridPagerAdapter and CardFragment Update When Shown
  • Bluetooth LE set advertising channel - Android
  • android OS not accepting the landscape mode design on orintation changes
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co