В моем проекте нужно показать уведомление каждый день в 2 часаМестного уведомлению каждый день в определенное время в андроиде
Я понятие не имею, о настройке временной интервал для повторного уведомления каждого день
Моего главного кодовой активности интервал времени
Intent myIntent = new Intent(Splash.this ,JobsNotification.class);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
PendingIntent pendingIntent = PendingIntent.getService(Splash.this, 0, myIntent, 0);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,12);
calendar.set(Calendar.MINUTE,26);
calendar.set(Calendar.SECOND,15);
alarmManager.setRepeating(AlarmManager.RTC,
calendar.getTimeInMillis() , AlarmManager.INTERVAL_DAY,
pendingIntent);
Сервис для уведомления
public class JobsNotification extends Service
{
@Override
public IBinder onBind(Intent arg0)
{
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate()
{
// TODO Auto-generated method stub
super.onCreate();
}
@SuppressWarnings("deprecation")
@Override
public void onStart(Intent intent, int startId)
{
super.onStart(intent, startId);
String strTitle="10 New Jobs Posted Today";
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.dailyjob)
.setContentTitle(strTitle)
.setContentText("");
Intent resultIntent = new Intent(this, Notify.class);
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(Notify.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
mBuilder.setAutoCancel(true);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(1, mBuilder.build());
// Uri notificationtune = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
// Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notificationtune);
// r.play();
}
@Override
public void onDestroy()
{
// TODO Auto-generated method stub
super.onDestroy();
}
}
Пожалуйста, помогите мне о настройке уведомлений каждый день только определенное время
Заранее спасибо
это настройка уведомления за один раз? – Salmaan