package fire.eagle.android;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class IntentReceiver extends BroadcastReceiver
{
public IntentReceiver()
{
super();
}
@Override
public void onReceive(Context ctx, Intent intent)
{
String action = intent.getAction();
Log.i("Fire Eagle", "IntentReceiver action = " + action);
if (Intent.ACTION_BOOT_COMPLETED.equals(action))
{
onBootCompleted(ctx, intent);
}
}
protected void onBootCompleted(Context ctx, Intent intent)
{
if (Preferences.getUserSpecificAccessToken().isValid())
{
Log.i("Fire Eagle", "about to start background service");
ComponentName result = ctx.startService(BackgroundService.getIntent(ctx));
if (result == null)
{
Log.e("Fire Eagle", "unable to start background service");
}
}
}
}