小编elo*_*eyn的帖子

Android启动服务永远不会启动

我是Android编程的新手.我有一个接收器在启动时启动服务但似乎从未启动过.你能告诉我我做错了什么吗?我不知道如何调试它.你能解释一下我如何调试Android启动服务吗?

这是我的代码.先感谢您

Recibidor.java:

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class Recibidor extends BroadcastReceiver {

   @Override
   public void onReceive(Context context, Intent intent) {
      Toast.makeText(context, "Iniciando Recibidor", Toast.LENGTH_LONG).show();
      final String TAG = "Recibidor";
      Log.i(TAG, "Iniciando Recibidor");

      if (intent.getAction().equalsIgnoreCase("android.intent.action.BOOT_COMPLETED")) {
         Toast.makeText(context, "Iniciando Intent", Toast.LENGTH_LONG).show();
         Log.i(TAG, "Iniciando Intent");

         Intent servicio = new Intent();
         servicio.setAction("com.pruebas.Servicio");
         context.startService(servicio);

         Log.i(TAG, "Iniciando Servicio");
         Toast.makeText(context, "Iniciando Servicio", Toast.LENGTH_LONG).show();
       }

   }
}
Run Code Online (Sandbox Code Playgroud)

Servicio.java

package com.pruebas;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;

public …
Run Code Online (Sandbox Code Playgroud)

service android startup broadcastreceiver

5
推荐指数
1
解决办法
1854
查看次数

编写一个Spring批量自定义项编写器

我需要编写一个使用页脚的Spring批量自定义项目编写器,但我不能使用委托模式.是否有另一种方法来编写Spring批量自定义项目编写器?

先感谢您.

spring-batch

1
推荐指数
1
解决办法
1万
查看次数