I need to update the information every 1h and I am using a BroadCastReceiver
.
If the user opens the APP, it works correctly doing everything every 1h.
But I need it to boot the phone and not just when to open the app.
But I do not know why, it says that my application has stopped after the phone calls. I do not know where the error is, since it comes at the end of the methods.
I'm calling AlarmService
like this:
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
Intent i = new Intent(context,AlarmReceiver.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
In my AlarmService
is the following code:
link
LogCat , I see that it is entering until it reaches the end of the code.
CHEGOU FINAL ANTES abrir arquivo
CHEGOU FINAL ANTES ESCREVER
CHEGOU FINAL
Where could the error be? Thank you in advance for your attention!