Autostart and notification bar
<p>I created an app that after boot completed starts an intent, an alarmamanager and next a notification bar. After reboot, Notify class runs, but at fixed time I didn't see notification on bar.</p>

<p>Another question: Can I starts notification bar from Notify class without call AlarmReceiver class?</p>

<p>AutoStart</p>

<pre><code>public class AutoStart extends BroadcastReceiver{

@Override
public void onReceive(Context context, Intent intent) {
        Intent i = new Intent(context, Notify.class);  
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i);  
}
</code></pre>

<p>Notify</p>

<pre><code>public class Notify extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

Calendar cal1 = Calendar.getInstance();
cal1.set(Calendar.HOUR_OF_DAY, 05);
cal1.set(Calendar.MINUTE, 45);
cal1.set(Calendar.SECOND, 00);

Calendar cal2 = Calendar.getInstance();
cal2.set(Calendar.HOUR_OF_DAY, 17);
cal2.set(Calendar.MINUTE, 30);
cal2.set(Calendar.SECOND, 00);

Calendar now = Calendar.getInstance();
if(now.after(cal1))
    cal1.add(Calendar.HOUR_OF_DAY, 24);
if(now.after(cal2))
    cal2.add(Calendar.HOUR_OF_DAY, 24);

Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent morningAlarm = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);
PendingIntent eveningAlarm = PendingIntent.getBroadcast(getApplicationContext(), 1, intent, 0);

AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal1.getTimeInMillis(), DateUtils.DAY_IN_MILLIS, morningAlarm);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal2.getTimeInMillis(), DateUtils.DAY_IN_MILLIS, eveningAlarm);
</code></pre>

<p>AlarmReceiver:</p>

<pre><code>public class AlarmReceiver extends BroadcastReceiver {

    final String not1[] = new String[37];
    int not1end = 36;
    int x;

    public void onReceive(Context context, Intent intent) {

not1[0]="one";
        not1[1]="two";
        not1[2]="three";


     String ns = Context.NOTIFICATION_SERVICE;
        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);

        int icon = R.drawable.ic_launcher;
        CharSequence tickerText = "Votre vidange approche";
        long when = System.currentTimeMillis();

        Notification notification = new Notification(icon, tickerText, when);


        CharSequence contentTitle = "Notification";
        CharSequence contentText = "Vérifier votre kilométrage";
        Intent notificationIntent = new Intent("org.gortcloud.perledisaggezza");
//        PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

        notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

        final int HELLO_ID = 1;

        mNotificationManager.notify(HELLO_ID, notification);
     }     
</code></pre>

<p>Manifest</p>

<pre><code>&lt;receiver 
    android:name=".Notify"
    android:exported="false" &gt;
    &lt;intent-filter&gt;
        &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
    &lt;/intent-filter&gt;
&lt;/receiver&gt;

&lt;receiver android:name="AlarmReceiver" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="com.example.AlarmReceiver" /&gt;
            &lt;/intent-filter&gt;

&lt;intent-filter&gt;
        &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
    &lt;/intent-filter&gt;
&lt;/receiver&gt;
</code></pre>
