I sent incomplete Code before:
This is how I set the Notification:
private void displayNotification(final String message) { Intent notificationIntent = new Intent(this, MyQtActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); int requestID = (int) System.currentTimeMillis(); PendingIntent contentIntent = PendingIntent.getActivity(this, requestID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// Display a notification with an icon, message as content, and default sound. It also // opens the app when the notification is clicked. NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon( R.drawable.icon) .setContentTitle(getString(R.string.push_demo_title)) .setContentText(message) .setDefaults(Notification.DEFAULT_SOUND) .setAutoCancel(true) .setContentIntent(contentIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0, builder.build()); }
But I don't know how Parse handles it. I might try to take the notificationIntent above and just startIntent() it from the handler and see what you get.
Sent: Tuesday, August 30, 2016 at 12:04 PM
From: "Nuno Santos" <nunosan...@imaginando.pt>
To: "Jason H" <jh...@gmx.com>
Cc: "Qt Project MailingList" <interest@qt-project.org>
Subject: Re: [Interest] Qt Android App and Notifications - Black screen after tapping a notification with app open on background.
From: "Nuno Santos" <nunosan...@imaginando.pt>
To: "Jason H" <jh...@gmx.com>
Cc: "Qt Project MailingList" <interest@qt-project.org>
Subject: Re: [Interest] Qt Android App and Notifications - Black screen after tapping a notification with app open on background.
None. Everything is done by Parse SDK. But in the snippet bellow I can override things.
On 30 Aug 2016, at 17:03, Jason H <jh...@gmx.com> wrote:What code are you using to show your activity from the notification?Sent: Tuesday, August 30, 2016 at 11:32 AM
From: "Nuno Santos" <nunosan...@imaginando.pt>
To: "Jason H" <jh...@gmx.com>
Cc: "Qt Project MailingList" <interest@qt-project.org>
Subject: Re: [Interest] Qt Android App and Notifications - Black screen after tapping a notification with app open on background.My launch mode is singleTop. I had singleTask but I have changed to singleTop without success. I don’t know the reason for having singleTask. I don’t remember.Also, I use Parse to receive and handle push notifications so I have the following filter to change the background color of the notification on Lollipopimport com.parse.ParsePushBroadcastReceiver;import android.app.Notification;import android.content.Context;import android.content.Intent;import android.os.Build;import android.util.Log;public class IPushBroadcastReceiver extends ParsePushBroadcastReceiver{@Overrideprotected Notification getNotification(Context context, Intent intent){Notification notification = super.getNotification(context, intent);if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){notification.color = 0xff000000;}return notification;}}On 30 Aug 2016, at 16:28, Jason H <jh...@gmx.com> wrote:I don't have a problem with notifcations like that.What are you doing to bring your activity to the front?I'd suspect you start an intent, and have the SINGLE_TOP flag on the activity, or something like that?Sent: Tuesday, August 30, 2016 at 11:12 AM
From: "Nuno Santos" <nunosan...@imaginando.pt>
To: "Qt Project MailingList" <interest@qt-project.org>
Subject: [Interest] Qt Android App and Notifications - Black screen after tapping a notification with app open on background.Hi,When my app has a notification I want to tap on the notification and open the app. If the app is closed, it works correctly. When the app is open in the background, it gets a black screen.Has anyone had this problem in the past? Any suggestion?Thanks,_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interestNuno
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest