Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Set multiple alarm on Android device by Qt
kybernetes last edited by kybernetes
i want to write an alarm program on android, is there any idea for that?
i found some android code but not for qt, for android studio.
Intent intent = new Intent(AlarmList.this, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(AlarmList.this, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager ALARM1 = (AlarmManager)getSystemService(ALARM_SERVICE); ALARM1.set(AlarmManager.RTC_WAKEUP, sdl, sender);
some more for symbian
// Creating a workday wakeup alarm XQAlarms* alarms = new XQAlarms(this); QDateTime alarmDateTime = alarmDateTime.currentDateTime(); alarmDateTime.setTime(QTime(15, 0)); // Create XQAlarm data object XQAlarm weeklyReport; weeklyReport.setExpiryTime(alarmDateTime); weeklyReport.setMessage("Do weekly report"); weeklyReport.setRepeatDefinition(XQAlarm::RepeatWeekly); alarms->addAlarm(weeklyReport);
i can play sound but for this i have to run my program for background and i dont know how also i need vibration too.
kornava last edited by
I think no way to do it from Qt directly,
but you still have the choice to make it with android java code inside your Qt App !
the principle is simple, you insert your alarm management code (without any layout items, like buttons) in a java file inside a method, then you add the package name, then you put the Java file inside the src path (you will find it in ANDROID folder inside your Qt project folder),
Now you have to call your Java method from the Qt side, this can be done easily if you understand this tuto:
You can make multiple methods, and transfer data between the two side (the Qt C++ and Android Java)