O aplicativo de notificação do Android não está funcionando corretamente

Estou desenvolvendo um aplicativo Android, e parte dele envolve uma notificação que lembra o usuário de fazer algo. Esta notificação em um horário especificado e se repete a cada 12 horas. estou a usarAlarmManager para agendar o alarme e também incluí o código para iniciar meu serviço de alarme quando o dispositivo inicializar. Aqui estão minhas classes java:

MainActivity.java

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SharedPreferences preferences = PreferenceManager
            .getDefaultSharedPreferences(this);
    SharedPreferences.Editor editor = preferences.edit();
    int i = preferences.getInt("numberoflaunches", 1);

    if (i < 2) {
        alarmMethod();
        i++;
        editor.putInt("numberoflaunches", i);
        editor.commit();
    }
}

private void alarmMethod() {

    Intent intent = new Intent(this, AlarmService.class);
    this.startService(intent);

    Toast.makeText(MainActivity.this, "Alarm Set", Toast.LENGTH_SHORT).show();

}

}  

AlarmService.java

public class AlarmService extends Service {

//used for register alarm manager
PendingIntent pendingIntent;
//used to store running alarm manager instance
AlarmManager alarmMgr;
//Callback function for alarm manager event
BroadcastReceiver mReceiver;

private static final String TAG = "MyService";

@Override
public IBinder onBind(Intent intent) {
    return null;
}

@Override
public void onCreate() {
    super.onCreate();

    //Register AlarmManager Broadcast receive.
    RegisterAlarmBroadcast();
}

@Override
public void onStart(Intent intent, int startid) {

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MINUTE, 30);
    calendar.set(Calendar.HOUR_OF_DAY, 6);

    alarmMgr.cancel(pendingIntent);
    alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), 1000 * 60 * 60 * 12, pendingIntent);

}

private void showNotification() {

    Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    Notification notification = new NotificationCompat.Builder(this)
            .setContentTitle("app_name")
            .setContentText("something")
            .setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT))
            .setSound(soundUri)
            .setSmallIcon(R.drawable.notification_icon)
            .setAutoCancel(true)
            .setOnlyAlertOnce(true)
            .build();

    NotificationManagerCompat.from(this).notify(0, notification);

}

private void RegisterAlarmBroadcast() {
    Log.i("RegisterAlarmBroadcast", "Register Intent.RegisterAlarmBroadcast");

    //This is the call back function(BroadcastReceiver) which will be called when your alarm time is reached.
    mReceiver = new BroadcastReceiver() {
        private static final String TAG = "Alarm Example Receiver";

        @Override
        public void onReceive(Context context, Intent intent) {
            Log.i(TAG, "BroadcastReceiver::OnReceive() >>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
            showNotification();
        }
    };

    //Register the alarm broadcast here
    registerReceiver(mReceiver, new IntentFilter("com.example.application.myNotification"));
    pendingIntent = PendingIntent.getBroadcast(this, 0, new Intent("com.example.application.myNotification"), 0);
    alarmMgr = (AlarmManager) (this.getSystemService(Context.ALARM_SERVICE));
}

public void onDestroy() {
    super.onDestroy();
    Log.d(TAG, "onDestroy");
}

}

autostart.java

public class autostart extends BroadcastReceiver {

@Override
public void onReceive(Context arg0, Intent arg1)
{
    Intent intent = new Intent(arg0,AlarmService.class);
    arg0.startService(intent);
    Log.i("Autostart", "started");
}
}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.application" >

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <receiver android:name=".autostart">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
    <service
        android:name=".AlarmService"
        android:enabled="true" />
</application>

No entanto, devo ter feito algo errado, pois não está funcionando corretamente. Meus problemas são:
1. Quando saio do aplicativo, a notificação, por algum motivo, apaga, seja qual for a hora.
2. Quando eu reinicio, a notificação dispara, independentemente da hora.

Não sei se esses problemas estão de alguma forma relacionados, talvez eu tenha um pedaço de código que está atrapalhando tudo. Mas de qualquer forma, eu realmente aprecio qualquer tipo de ajuda que possa obter. Desde já, obrigado.

questionAnswers(1)

yourAnswerToTheQuestion