I am calling a broadcast receiver from class FragmentA -
FragmentA:
public void onReceive(Context context, Intent intent)
{
Log.i(TAG, "------onReceive BroadcastReceiver------");
streamContext = context;
for(int i = 0; i< 3;i++)
{
startSpeedInt = i;
Intent msgIntent = new Intent(streamContext, triggerService.class);
msgIntent.putExtra("startSpeedInt", startSpeedInt);
streamContext.startService(msgIntent);
}
}
The triggerService is a service -
triggerService:
public class triggerService extends IntentService{
public triggerService() {
super("triggerService");
mHandler = new Handler();
ctx = this;
}
@Override
protected void onHandleIntent(Intent intent) {
Log.i(TAG, "----onHandleIntent triggerService Started----");
}
//more code here
}
Manifest entry:
<service android:name="com.testapp.main.triggerService" />
I noticed that my code never reaches the triggerService because the Log message is not getting printed out.
Can we not queue the call to IntentService each time we increment variable i ?