My app closes device low memory

433 views Asked by At

I am developing an app for android 4.0 that uses services. The app works fine and does not crash. However, when I start a heavy app on my Galaxy s3 the app closes, for example. When I use Candy Crash my app crashes for no reason.

Is it because that device is on low memory and my app doesn't close correctly? Or maybe it is because I use getApplicationContext() inside the service?

my service only activated on a specific time.

thanks for your help. you can see the problem yourself by downloading it https://play.google.com/store/apps/details?id=com.digicode.keepintouch

this is the code of the service: public void startRemindersService(Context context) { Intent myIntent = new Intent(context, MyAlarmService.class);

    myIntent.putExtra(CONSTANTS.CONTACT_ID, "-1");

    int id = 2;
    PendingIntent pendingIntent = PendingIntent.getService(context, id,
            myIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.HOUR_OF_DAY, 8);
    calendar.set(Calendar.MINUTE, 55);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.DAY_OF_YEAR, 1);

    AlarmManager alarmManager = (AlarmManager) context
            .getSystemService(Context.ALARM_SERVICE);
    alarmManager.cancel(pendingIntent);

    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY,
            pendingIntent);

}

0

There are 0 answers