Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android: Concept for day-sensitive scheduled App-start (Alarm Clock)
Forum Updated to NodeBB v4.3 + New Features

Android: Concept for day-sensitive scheduled App-start (Alarm Clock)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 196 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Flaming MoeF Offline
    Flaming MoeF Offline
    Flaming Moe
    wrote on last edited by Flaming Moe
    #1

    Hoí there,

    somehow I´m not able to find an explicit english forum for Android develoopment - which I find hard to believe to extend, I think I´m missing something...

    How ever

    In the scope of an individual alarm-clock app based on Qt , running on Android, I´m trying to figure out, what the approrpiate way is, to start an app at a certain time AND certain selectable days.

    What does already work
    I do have solved to start my app at a given time from what I found link text and in addition squeezing ChatGPT.

    public class RestartNotificationClient
    {
        private static AlarmManager alarmMgr;
        private static PendingIntent alarmIntent;
    
        //private static OverlayAppToLockScreen;
    
        public static void notify(Context context, int hour, int minute) {
    
                alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
                //Intent intent = new Intent();
                //intent.setComponent(new ComponentName("org.qtproject.example.androidnotifier", "AlarmNotification"));
                Intent intent = context.getPackageManager().getLaunchIntentForPackage("org.qtproject.example.androidnotifier");
    
                //System.out.println(view);
                if(intent == null) System.out.println("Wrong wrong wrong wrong");
                alarmIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
    
                Calendar calendar = Calendar.getInstance();
                calendar.setTimeInMillis(System.currentTimeMillis());
                calendar.set(Calendar.HOUR_OF_DAY, hour);
                calendar.set(Calendar.MINUTE, minute);
                alarmMgr.setExact(  AlarmManager.RTC_WAKEUP,
                                    calendar.getTimeInMillis(),
                                    alarmIntent);
            }
    }
    

    What I´m wondering
    Since the app is an alarm-clock, it is also possible to choose the day - e.g. monday to friday out of the whole week.
    How would I sensibly implement that?
    Would it be like per day having a weekly scheduled alarm set - so up to 7 alarms / intents per alarm-instance?
    Or is there a more clever way?

    A lovely day for a ̶g̶̶u̶̶i̶̶n̶̶n̶̶e̶̶s̶ DUFF^^

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved