0
내가 특정 시간에 알림 메시지를 표시하기 위해 튜토리얼을 따라 작동하지 않습니다하지만 여기 알림 메시지는
이//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" />
내가 달력 객체에 지정된 아무것도하지만, 내가 어떤 도움이 이해할 수있을 것이다
어떤 일을 놓친 나도 몰라, 표시되지 않습니다 시간을 기다릴