Skip to content Skip to sidebar Skip to footer

Unable To Schedule Notification With Alarmmanager On Android (using Qt)

I am doing the following from a qt 5.5. project. I am trying to schedule a local notification using the alarm manger in android. This is the code to schedule the notification: clas

Solution 1:

Honestly not 100 percent sure why yours is not working but I suspect it is the 0 being passed in. I would think that this should be System.currentTimeInMillis() + SOME_SHORT_INTERVAL ?

This is a working example of an Alarm Manager setup. Yeah I know its different, but it is something to compare

IntentsyncIntent=newIntent(this, SyncIntentService.class);
       syncIntent.putExtra(EXTRA_REQUEST_KEY,   
       SyncRequestTypes.REQUEST_BACKGROUND_SYNC.name());

    PendingIntentpi= PendingIntent.getService(this, 0, syncIntent,
      Intent.FLAG_ACTIVITY_NO_USER_ACTION);

    // Register first run and then interval for repeated cycles.


   alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
            SystemClock.elapsedRealtime() + DEFAULT_INITIAL_RUN_TEST,
            DEFAULT_RUN_INTERVAL_TEST, pi);

Solution 2:

I had an error in the AndroidManifest.xml. The NotificationPublisher needs to be registered as a receiver, like this:

<receiverandroid:name="de.goodpoint_heidelberg.NotificationPublisher"android:enabled="true"/>

Post a Comment for "Unable To Schedule Notification With Alarmmanager On Android (using Qt)"