Saturday, 15 August 2015

android - Calling Service From Broadcastreceiver Issue -


I need to use a service within the broadcasting receiver (I start the receiver with an alarm), but the problem It happens when I have to call service. Apparently this was never executed. It was never executed. I have also set debugger to check, but this is not also related to the code.

I do not know why the service never triggered

my receiver call

  private zero getHour () {/ / Use it to start and trigger service INTENCE i = new intent (reference, getHourService.class); I.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Context.startService (i); }  

service

  public class provides getHourService service {public int horaR; Public IT Miner; @ Override public int onStartCommand (intended intent, int flags, int startId) {android.os.Debug.waitForDebugger (); // some logical code here}}  

I add to the manifest

  & lt; Application Android: allowBackup = "true" android: icon = "@ Mipmap / ic_launcher" android: label = "@ string / app_name" Android: Theme = "@ Style / Aaptim" & gt; & Lt; Activity Android: Name = ". Main Activity" Android: label = "@ string / app_name" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt ;! - Too many receivers - & gt; & Lt ;! - service - & gt; & Lt; Service Android: name = "alarmas.getHourService" & gt; & Lt; / Services & gt; & Lt; / Application & gt;  


No comments:

Post a Comment