سلام دوستان
من برنامه ای نوشتم که با Alarm Manager کار کنه و در هر چند ثانیه یه notification برام بیاره
ولی اجرا ندارم
نمی دونم مشکل از کجاست؟
این کلاس برای نمایش notification هست

public class NotifyService extends Application {
private Notification.Builder myNotification;
private static final int id = 1;


@Override
public void onCreate() {
super.onCreate();
//
myNotification = new Notification.Builder(G.context);
myNotification.setAutoCancel(true);
myNotification.setSmallIcon(R.drawable.programmer) ;
myNotification.setTicker("ddd");
myNotification.setWhen(System.currentTimeMillis()) ;
myNotification.setContentText("sssssssss");
myNotification.setContentTitle("dddssww");
Intent intent = new Intent(G.context, NotifyService.class);
PendingIntent pendingIntent = PendingIntent.getActivities(
G.context, 0, new Intent[]{intent}, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationManager notificationManager = (NotificationManager) G.context.getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(id, myNotification.build());
}
}





و در Activity هم کد هایی که نوشتم


AlarmManager alarmManager=(AlarmManager) G.context.getSystemService(G.context.ALARM_SERVICE );
Intent alarmIntent=new Intent(SensorInfoActivity.this,NotifyService.class );
PendingIntent pendingIntent=PendingIntent.getBroadcast(G.context , 0, alarmIntent, 0);
alarmManager.setRepeating(AlarmManager.RTC, System.currentTimeMillis(), 1000 * 5, pendingIntent);