[Interest] Qt Android App and Notifications - Black screen after tapping a notification with app open on background.
Nuno Santos
nunosantos at imaginando.pt
Tue Aug 30 18:34:16 CEST 2016
I have the following error:
error: no suitable constructor found for Intent(IPushBroadcastReceiver,Class<DRCActivity>)
It seems not being able to consider my activity class valid. What am I doing wrong?
> On 30 Aug 2016, at 17:19, Jason H <jhihn at gmx.com> wrote:
>
> 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" <nunosantos at imaginando.pt>
> To: "Jason H" <jhihn at gmx.com>
> Cc: "Qt Project MailingList" <interest at 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 <jhihn at gmx.com <x-msg://62/jhihn@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" <nunosantos at imaginando.pt <x-msg://62/nunosantos@imaginando.pt>>
> To: "Jason H" <jhihn at gmx.com <x-msg://62/jhihn@gmx.com>>
> Cc: "Qt Project MailingList" <interest at qt-project.org <x-msg://62/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 Lollipop
>
> import 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
> {
> @Override
> protected 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 <jhihn at 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" <nunosantos at imaginando.pt <>>
> To: "Qt Project MailingList" <interest at 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,
>
> Nuno
> _______________________________________________ Interest mailing list Interest at qt-project.org <> http://lists.qt-project.org/mailman/listinfo/interest <http://lists.qt-project.org/mailman/listinfo/interest>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160830/608644fe/attachment.html>
More information about the Interest
mailing list