service does not start after clearing the memory

0

Hello everyone, I'm developing an application that requires a service to warn the user according to events at large intervals, sometimes within 24 hours ...

my 2 problems are as follows, my cell phone as many, has the function to "clear the memory" when I run this function, my service is deleted and it will never run again unless I open the app again. I noticed qe other app like facebook, whatsapp, messenger continue to run normally after this process

the other is to restart the mobile phone service does not run at boot Important information: I tested the android studio emulator, and the start as I set it, it works ... but in my cell phone, for example no ... and not of any error. I configured it as follows: no manifest:

  <receiver android:name=".StartUpBootReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

'public class StartUpBootReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    NotificacaoController valor = new NotificacaoController(context);
    Toast.makeText(context,"ENTROU no STARTBOOTSERVICE",Toast.LENGTH_LONG).show();

    if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) && valor.returnNotificacao().equals("true")) {
        Toast.makeText(context,"STARTBOOTSERVICE",Toast.LENGTH_LONG).show();
        System.out.println("-------------------------------------------STARTBOOT");
        context.startService(new Intent(context, ShowNotificationService.class));
    }
}

'

    
asked by anonymous 27.01.2017 / 12:59

0 answers