AndroidStartServiceOnBoot.class在程序中只调用一次..但我希望它每次调用

时间:2014-11-23 04:56:36

标签: android

我希望每次都能执行androidStartServiceOnBoot.class。但它只执行一次。

@Override
public void onReceive(Context context, Intent intent) {
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "YOUR TAG");
    //Acquire the lock
    wl.acquire();

    //You can do the processing here.
    Bundle extras = intent.getExtras();
    StringBuilder msgStr = new StringBuilder();

    if(extras != null && extras.getBoolean(ONE_TIME, Boolean.FALSE)){
    //Make sure this intent has been sent by the one-time timer button.
    msgStr.append("One time Timer : ");
    }
    Format formatter = new SimpleDateFormat("hh:mm:ss a");
    msgStr.append(formatter.format(new Date()));
    Intent serviceIntent = new Intent(context, AndroidStartServiceOnBoot.class);
    context.startService(serviceIntent);
    Toast.makeText(context, msgStr + "test", Toast.LENGTH_LONG).show();
    //Release the lock
    wl.release();
 }

1 个答案:

答案 0 :(得分:0)

从你的PHP脚本或其他任何东西返回的响应... 附有标签  1.echo" br" ----对于php 等....(删除这个为PHP) 检查从服务器返回的响应。从驻留在服务器上的文件返回响应时,应该没有
标签