Please nominate your Qt Champions for 2021!

Android notification don't appear

  • hello , I have problem with android notification , i just copied the java and notificationClient class from qt notification example ,and register new type in my main


    of course i added

    QT +=androidextras
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources

    and changed the package name in java code
    this is the java code

    package org.qtproject.example.androidpi;
    import android.content.Context;
    public class NotificationClient extends
        private static NotificationManager m_notificationManager;
        private static Notification.Builder m_builder;
        private static NotificationClient m_instance;
        public NotificationClient()
            m_instance = this;
        public static void notify(String s)
            if (m_notificationManager == null) {
                m_notificationManager = (NotificationManager)m_instance.getSystemService(Context.NOTIFICATION_SERVICE);
                m_builder = new Notification.Builder(m_instance);
                m_builder.setContentTitle("A message from Qt!");

    when i compile all work fine but notification don't appear ,if you want more information i can give all the code

Log in to reply