In background running android app sending notification



  • hi
    ive got a question. Am I with Qt able to write an app that is running in background and sends at 7:00 am a notifiction
    that the user sees informationin his notification bar at top?

    generell is there a posibility that my app runs in background?

    thanks for answering!
    Mathias



  • I have the same problem.
    The program calls correctly the notification api but I see the notifications only if I restore the program.
    If minimized doesn't work immediately but when it is full screen I see the notification immediately.
    Have you found the solution?



  • Hi,
    yes you can, by using this plugin for local push notifications that works for iOS & Android.

    You can find a Github example here.

    And here's a sample QML code:

    import QtQuick 2.1
    import QtQuick.Window 2.1
    
    import VPlayPlugins.notification 1.0
    
    Window {
      NotificationManager {
    	id: notificationManager
      }
    
      Notification {
    	id: idleNotification
    
    	notificationId: "idleNotification"
    	message: "Anyone here? Haven't seen you in a while..."
    	timeInterval: (24 * 60 * 60) // in seconds
      }
    
      Component.onCompleted: {
    	// Cancel old notification if scheduled
    	notificationManager.cancelNotification(idleNotification.notificationId)
    	// Schedule idleNotification
    	notificationManager.scheduleNotification(idleNotification)
      }
    }
    

    Cheers, Chris


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.