Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Android] Open dialog when notification gets clicked



  • Hi,

    Is there a possibility to open a dialog window instead of the application when a new push notification is received? I already got push notifications to work, but instead of opening the app in fullscreen mode when the notification gets clicked I want to only show a dialog (like a quick reply dialog). So basically I want something similar to this: http://stackoverflow.com/questions/19080511/how-to-send-reply-from-expandable-notification-in-android

    When the user clicks on "Reply" a "quick reply dialog" opens where the user can quickly reply to the message. Is that dialog thing possible with Qt?

    Any help is really appreciated.
    Thanks for your time,
    Bernhard



  • After reading a bit more, it looks like that I would need multiple activites for that? But is that possible with Qt?

    What I was also thinking was to somehow pass a parameter to the Qt application when it gets started to tell the applocation if it should behave as a dialog or full application. But I don't know if that's somehow possible?

    Best regards,
    Bernhard



  • It's possible to have multiple qt activities as long as they are running in separate processes (check https://developer.android.com/guide/topics/manifest/activity-element.html#proc).
    It is also possible to pass some parameters to the main function to distinct from the "normal" activity.

    So the steps are:

    • copy the <activity ... >...</activity> element.
    • add android:process=":unique_tag" attribute to the activity element
    • add " <meta-data android:name="android.app.arguments" android:value="-dialog"/> element to the activity element

    BogDan.



  • @BogDan-Vatra

    First of all, many thanks for helping me with this, Bogdan!

    I tried it, and it worked! am really happy now.

    The only problem left is, that the Activity always starts in fullscreen mode. I tried to use Window and ApplicationWindow as root object for the popup dialog, but no matter which height/width I set via QML, it always opens in fullscreen. Do you know maybe also know how I can accomplish that?

    My gut feeling is, that I need to modify the AndroidManifest somehow, but I haven't found anything yet.

    Many thanks!


Log in to reply