简体   繁体   English

即使在使用服务后,应用也被杀死

[英]App is getting killed even after using Service

I want to make my app run always even after removed from App tray by the user. 我想让我的应用程序始终运行,即使在用户从应用程序托盘中删除它之后也是如此。 After terminating app ,it didn't pertain in background. 终止应用程序后,它与后台无关。 I created MyService class which has a AsyncTask which download content from web. 我创建了具有AsyncTask的MyService类,该类可以从Web下载内容。 It works all fine but unable to run in background. 一切正常,但无法在后台运行。 What should I change int this? 我应该怎样改变呢?

my MainActivity.java is: 我的MainActivity.java是:

package com.example.shubhamrajput.notify;

import ... 

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        startService(new Intent(this, MyService.class));


    }
}

// MyService.java // MyService.java

    package com.example.shubhamrajput.notify;
    import ...

    public class MyService extends Service {
        private int mInterval = 2000;
        private Handler mHandler;
        String RESULT=null;
        public class DownloadTask extends AsyncTask<String, Void, String> {
                //code here

   }

 }
    void updateTask(){
        DownloadTask task = new DownloadTask();
        String result = null;

        try {

            result = task.execute("https://time.is").get();
            //Log.i("result is ",result);
            if(!result.equals(RESULT)){
                if(RESULT==null)
                RESULT=result;
                else
                addNotification();
            }

        } catch (InterruptedException e) {

            e.printStackTrace();

        } catch (ExecutionException e) {

            e.printStackTrace();

        }
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    public int onStartCommand(Intent intent,int flags,int startId){
        mHandler = new Handler();
        startRepeatingTask();
        return START_STICKY;

    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        Intent restartService = new Intent("RestartService");
        sendBroadcast(restartService);

    }

    Runnable mStatusChecker = new Runnable() {
        @Override
        public void run() {
            try {
                updateTask();//this function can change value of mInterval.
            } finally {
                // 100% guarantee that this always happens, even if
                // your update method throws an exception
                mHandler.postDelayed(mStatusChecker, mInterval);
            }
        }
    };

    void startRepeatingTask() {
        mStatusChecker.run();
    }

    void stopRepeatingTask() {
        mHandler.removeCallbacks(mStatusChecker);
    }
    private void addNotification(){
       // code here
     }
}

and RestartService.java is 和RestartService.java是

    package com.example.shubhamrajput.notify;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class RestartService extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

        context.startService(new Intent(context,MyService.class));
    }
}

logcat 日志猫

18:24:26.102 5207-5207/? I/art: Not late-enabling -Xcheck:jni (already on)
08-23 18:24:26.103 5207-5207/? W/art: Unexpected CPU variant for X86 using defaults: x86
08-23 18:24:26.132 5207-5214/? I/art: Debugger is no longer active
08-23 18:24:26.132 5207-5214/? I/art: Starting a blocking GC Instrumentation
08-23 18:24:26.195 5207-5207/? W/System: ClassLoader referenced unknown path: /data/app/com.example.shubhamrajput.notify-1/lib/x86
08-23 18:24:26.204 5207-5207/? I/InstantRun: starting instant run server: is main process
08-23 18:24:26.212 5207-5223/? D/NetworkSecurityConfig: No Network Security Config specified, using platform default
08-23 18:24:28.822 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.693ms
08-23 18:24:31.680 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.280ms
08-23 18:24:35.428 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 9.350ms
08-23 18:24:41.961 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.408ms
08-23 18:24:42.022 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.318ms
08-23 18:24:43.672 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.435ms
08-23 18:24:49.739 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.680ms
08-23 18:24:51.760 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.013ms
08-23 18:24:51.867 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.348ms
08-23 18:24:53.070 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 10.149ms
08-23 18:24:54.248 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.333ms
08-23 18:24:55.250 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.010ms
08-23 18:24:55.711 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.875ms
08-23 18:24:55.754 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.557ms
08-23 18:24:55.838 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.844ms
08-23 18:24:58.263 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.099ms

                                                                     [ 08-23 18:24:58.319  3533: 3545 D/         ]
                                                                     HostConnection::get() New Host Connection established 0x8477eac0, tid 3545


                                                                     [ 08-23 18:24:58.320  3533: 3545 W/         ]
                                                                     Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 
08-23 18:25:00.254 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.077ms
08-23 18:25:00.277 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 16.859ms
08-23 18:25:00.972 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 10.163ms
08-23 18:25:01.248 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 28.827ms
08-23 18:25:01.280 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.717ms
08-23 18:25:03.273 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.504ms
08-23 18:25:04.417 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.724ms
08-23 18:25:04.657 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 11.631ms
08-23 18:25:04.819 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 14.049ms
08-23 18:25:05.174 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.277ms
08-23 18:25:11.821 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.136ms
08-23 18:25:11.897 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 16.121ms
08-23 18:25:11.971 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 24.500ms
08-23 18:25:12.350 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 13.583ms
08-23 18:25:12.522 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 38.124ms
08-23 18:25:12.844 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.975ms
08-23 18:25:13.186 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.236ms
08-23 18:25:13.262 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.541ms
08-23 18:25:13.755 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 34.887ms
08-23 18:25:13.997 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.700ms
08-23 18:25:14.099 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 16.761ms
08-23 18:25:14.539 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.334ms
08-23 18:25:15.829 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 22.346ms
08-23 18:25:17.123 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 18.191ms
08-23 18:25:17.324 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.432ms
08-23 18:25:17.628 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.359ms
08-23 18:25:17.939 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.734ms
08-23 18:25:17.993 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 15.404ms
08-23 18:25:18.025 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 13.569ms
08-23 18:25:18.079 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.158ms
08-23 18:25:18.145 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 13.924ms
08-23 18:25:18.176 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 18.175ms
08-23 18:25:18.957 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 15.625ms
08-23 18:25:19.199 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.861ms
08-23 18:25:19.276 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 16.004ms
08-23 18:25:19.678 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.485ms
08-23 18:25:19.851 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.641ms
08-23 18:25:19.963 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.687ms
08-23 18:25:20.199 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 17.084ms
08-23 18:25:20.292 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.772ms
08-23 18:25:20.327 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.731ms
08-23 18:25:20.427 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.360ms
08-23 18:25:20.639 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.541ms
08-23 18:25:20.832 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.922ms
08-23 18:25:20.889 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 23.291ms
08-23 18:25:20.980 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 31.347ms
08-23 18:25:20.991 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.328ms
08-23 18:25:21.017 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 10.429ms
08-23 18:25:21.256 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 60.391ms
08-23 18:25:21.310 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.052ms
08-23 18:25:21.328 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.033ms
08-23 18:25:21.513 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 22.208ms
08-23 18:25:21.678 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 17.023ms
08-23 18:25:22.064 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 31.070ms
08-23 18:25:25.317 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.225ms
08-23 18:25:28.827 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.270ms
08-23 18:25:31.334 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.234ms
08-23 18:25:32.578 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.678ms
08-23 18:25:36.615 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.370ms
08-23 18:25:36.707 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.945ms
08-23 18:25:38.966 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.444ms
08-23 18:25:40.403 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 9.669ms
08-23 18:25:40.908 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.284ms
08-23 18:25:40.998 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.747ms
08-23 18:25:41.271 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 40.258ms
08-23 18:25:42.715 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 9.205ms
08-23 18:25:46.815 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.927ms
08-23 18:25:52.409 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.287ms
08-23 18:25:54.991 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.458ms
08-23 18:25:55.439 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.980ms
08-23 18:25:55.541 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.313ms
08-23 18:25:56.845 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.306ms
08-23 18:26:01.966 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.206ms
08-23 18:26:03.948 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 11.944ms
08-23 18:26:04.736 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.908ms
08-23 18:26:05.642 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.964ms
08-23 18:26:05.859 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.964ms
08-23 18:26:05.998 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.545ms
08-23 18:26:06.166 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.037ms
08-23 18:26:06.419 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.476ms
08-23 18:26:07.923 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.327ms
08-23 18:26:09.440 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 17.883ms
08-23 18:26:14.859 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 10.090ms
08-23 18:26:16.667 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.004ms
08-23 18:26:17.994 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 31.565ms
08-23 18:26:18.026 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 22.893ms
08-23 18:26:18.058 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 16.270ms
08-23 18:26:18.314 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 11.872ms
08-23 18:26:21.140 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 17.740ms
08-23 18:26:24.221 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.161ms
08-23 18:26:24.527 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.450ms
08-23 18:26:24.676 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 26.055ms
08-23 18:26:28.636 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.103ms
08-23 18:26:28.694 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.885ms
08-23 18:26:29.539 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.648ms
08-23 18:26:31.540 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 8.168ms
08-23 18:26:31.555 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 11.065ms
08-23 18:26:32.043 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.302ms
08-23 18:26:32.134 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.615ms
08-23 18:26:35.863 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.054ms
08-23 18:26:36.467 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.481ms
08-23 18:26:36.491 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.896ms
08-23 18:26:37.079 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 28.854ms
08-23 18:26:37.521 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.144ms
08-23 18:26:37.561 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 9.727ms
08-23 18:26:37.970 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.448ms
08-23 18:26:38.029 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.691ms
08-23 18:26:38.232 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 69.654ms
08-23 18:26:38.719 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.586ms
08-23 18:26:49.084 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.198ms
08-23 18:26:49.585 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.021ms
08-23 18:26:51.587 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.090ms
08-23 18:26:54.093 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.229ms
08-23 18:26:59.102 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.488ms
08-23 18:27:10.126 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.304ms
08-23 18:27:10.627 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.219ms
08-23 18:27:12.365 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 12.545ms
08-23 18:27:13.617 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 7.829ms
08-23 18:27:19.236 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 6.295ms
08-23 18:27:19.281 5207-5218/com.example.shubhamrajput.notify W/art: Suspending all threads took: 9.944ms

                                                                     [ 08-23 18:27:19.286  8988: 9067 D/         ]
                                                                     HostConnection::get() New Host Connection established 0x99cfe5c0, tid 9067


                                                                     [ 08-23 18:27:19.287  8988: 9067 W/         ]
                                                                     Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 
08-23 18:27:33.060 5207-5218/com.example.shubhamrajput.notify I/art: WaitForGcToComplete blocked for 5.097ms for cause Background
08-23 18:28:02.834 5207-5214/com.example.shubhamrajput.notify W/art: Suspending all threads took: 5.699ms

Android Manifest: Android清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.shubhamrajput.notify">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- defining the service class here -->
        <service android:name=".MyService" />
        <service
            android:name=".MyIntentService"
            android:exported="false"></service>
    </application>

</manifest>

When the user swipes the app from the recent task list, onTaskRemoved will be invoked in your service (if not specified otherwise in the manifest via the stopWithTask flag) and this is a "good place to restart your service" for the use case you described. 当用户从最近的任务列表中滑动应用程序时,onTaskRemoved将在您的服务中调用(如果未通过stopWithTask标志在清单中另外指定),对于您描述的用例,这是“重新启动服务的好地方” 。

Check the answers for a detailed explanation: https://stackoverflow.com/a/41257604/1865583 检查答案以获取详细说明: https : //stackoverflow.com/a/41257604/1865583

The relevant code snippet is as follows: 相关代码段如下:

@Override
public void onTaskRemoved(Intent rootIntent){
    Intent restartServiceTask = new Intent(getApplicationContext(),this.getClass());
    restartServiceTask.setPackage(getPackageName());    
    PendingIntent restartPendingIntent =PendingIntent.getService(getApplicationContext(), 1,restartServiceTask, PendingIntent.FLAG_ONE_SHOT);
    AlarmManager myAlarmService = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
    myAlarmService.set(
            AlarmManager.ELAPSED_REALTIME,
            SystemClock.elapsedRealtime() + 1000,
            restartPendingIntent);

    super.onTaskRemoved(rootIntent);
}

Regarding your own solution, add some logs to see what is going on, is your onDestroy being called, is your receiver receiving the call? 关于您自己的解决方案,请添加一些日志以查看发生了什么情况,是否正在调用onDestroy,接收方是否正在接收呼叫? Did you maybe forget to register it in your manifest? 您是否忘了在清单中注册它?

Keep in mind that onDestroy is not guaranteed to be called in some cases. 请记住,在某些情况下不能保证调用onDestroy。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 应用被杀死时,服务正在重新启动 - Service is getting restart when app is killed 即使在服务被系统杀死后,Service 内部的线程也会继续运行 - Thread inside Service keep running even after the service is killed by the system 使广播接收器监听事件,即使应用无服务而被杀死 - Make a broadcastreceiver listening for events even when app is killed without service 即使应用程序在MI设备中被杀死,如何运行后台服务 - How to run a background service even the app is killed in MI devices Android 前台服务即使在被杀死后仍保持麦克风访问权限 - Android foreground service holds microphone access even after being killed 前台服务被杀 - Foreground service getting killed 广播接收器即使在app被用户杀死后仍然工作 - Broadcast receiver working even after app is killed by user 应用程序被任务管理器杀死后,该服务是否仍然可以运行? - Is it possible that the service still runs after the app got killed with task manager? 如何在没有服务的情况下杀死应用程序后在后台线程中运行代码? - How to run code in background thread after app is killed without Service? Android中使用sinch的来电通知,我正在使用FireBase Messaging服务,但当应用程序在后台被杀死时却无法接听电话 - Incoming call Notification using sinch in Android ,I am Using FireBase Messaging service but not getting calls when app is killed in background
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM