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

问题描述:

我希望androidStartServiceOnBoot.class应该每次执行,但它只执行一次。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”); //获取锁 wl.acquire();正从乌尔PHP脚本或任何返回

  //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(); 
} 
+0

您尝试解析的字符串不是有效的json。 – 2014-11-23 05:15:35

响应... 被具有附装作为 1.echo“BR”一个
标签----为PHP 等....(删除这对于PHP) 检查你的响应返回从服务器..应该没有
标记,同时返回来自服务器上的文件的响应

+0

我的PHP脚本..怎么办? – 2014-11-23 08:15:29