Android 通知消息不起作用

Android 通知消息不起作用,android,Android,我按照教程在特定时间显示通知消息,但我不知道为什么它不起作用 这里是方法 //notification private void startAlarm() { AlarmManager alarmManager = (AlarmManager) this.getSystemService(this.ALARM_SERVICE); Calendar Calendar_Object = Calendar.getInstance(); Ca

我按照教程在特定时间显示通知消息,但我不知道为什么它不起作用

这里是方法

//notification
    private void startAlarm() {

        AlarmManager alarmManager = (AlarmManager) this.getSystemService(this.ALARM_SERVICE);

        Calendar Calendar_Object  = Calendar.getInstance();
        Calendar_Object.set(Calendar.MONTH, 12);
        Calendar_Object.set(Calendar.YEAR, 2014);
        Calendar_Object.set(Calendar.DAY_OF_MONTH, 31);

        Calendar_Object.set(Calendar.HOUR_OF_DAY, 9);
        Calendar_Object.set(Calendar.MINUTE, 06);
        Calendar_Object.set(Calendar.SECOND, 0);

                Intent intent = new Intent(ManagePassengers.this, AlarmReciver.class);
                PendingIntent pendingIntent = PendingIntent.getBroadcast(ManagePassengers.this, 0, intent, 0);
                alarmManager.set(AlarmManager.RTC, Calendar_Object.getTimeInMillis(), pendingIntent);
            }
广播课

public class AlarmReciver extends BroadcastReceiver {

 @Override
 public void onReceive(Context context, Intent intent) {
 // When our Alaram time is triggered , this method will be excuted (onReceive)
 // We're invoking a service in this method which shows Notification to the User
  Intent myIntent = new Intent(context, NotificationService.class);
  context.startService(myIntent);
}}
服务等级

public class NotificationService extends Service {

private NotificationManager mManager;

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

@Override
public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    // Getting Notification Service
    mManager = (NotificationManager) this.getApplicationContext()
            .getSystemService(
                    this.getApplicationContext().NOTIFICATION_SERVICE);

    Intent intent1 = new Intent(this.getApplicationContext(), ManageRides.class);

    Notification notification = new Notification(R.drawable.icon,
            "See My App something for you", System.currentTimeMillis());

    ...

    mManager.notify(0, notification);
  }
  ....

}
清单编辑

<uses-permission android:name="android.permission.WAKE_LOCK" />
<activity android:name=".AlarmReciver" />
<activity android:name=".NotificationService" />
我等待在calendar对象中指定的时间,但没有显示任何内容,我不知道是否遗漏了任何内容


如果您的服务和接收器组件注册错误,我们将不胜感激。清单中的服务和接收方示例如下所示:

<service
  android:name="MyService"
  android:icon="@drawable/icon"
  android:label="@string/service_name"
  >
</service> 

<receiver android:name="MyScheduleReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
</receiver>
查看以下教程: