private void restartService() { Intent restartServiceIntent = new Intent(getApplicationContext(), ((Object) this).getClass()); restartServiceIntent.setPackage(getPackageName()); PendingIntent restartServicePendingIntent = PendingIntent.getService( getApplicationContext(), 1, restartServiceIntent, PendingIntent.FLAG_ONE_SHOT); // ensure fire off AlarmManager alarmService = (AlarmManager) getApplicationContext().getSystemService(ALARM_SERVICE); alarmService.set( AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + 1000, restartServicePendingIntent); }