ユーザーがアプリを終了したら、データベース内の特定のレジストリを削除しようとしています。その問題については、アプリケーション ID が破棄されたときに理論的に実行される IntentService を呼び出します。問題は、このインテントが意図したとおりに機能せず、レジストリが削除されないことです。あなたが助けることができるなら、ここにコードがあります。インテントサービス:
public class FinIntentService extends IntentService{
    String levelstring = "22";
    int pid;
    static String pids;
    BroadcastReceiver batteryReceiver = null;
    String url = "10.0.0.13";
    private static String url_crear = "http://10.0.0.13/subida/create_candidato.php";
    private static final String url_delete = "http://10.0.0.13/subida/delete_candidato.php";
    JSONParser jsonParser = new JSONParser();
    @SuppressLint("NewApi")
    static String device_id = Build.SERIAL;
    static String PDA = device_id.substring(device_id.length() - 6);
            public FinIntentService() {
                    super("FinIntentService");
                }
            @Override
            protected void onHandleIntent(Intent intent)
            {
               int success;
                    try {
                        List<NameValuePair> params = new ArrayList<NameValuePair>();
                        params.add(new BasicNameValuePair("id", Titulacion.getPID()));
                        JSONObject json = jsonParser.makeHttpRequest(
                                url_delete, "POST", params);
                        Log.d("Delete Product", json.toString());
                        success = json.getInt("success");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
            }
        }
たとえば、ログに到達していません
主な活動:
public void onDestroy(){
    super.onDestroy();
    Intent msgIntent = new Intent(Titulacion.this, FinIntentService.class);
    startService(msgIntent);
}
前に Asynctask を使用しようとしましたが、onDestroy のときに目的の効果が得られませんでした。ただし、場合によっては (30 のうちの 1 つ)、synctask がそのタスクを実行しました。