[android] How do I run the app's activity?
Unsolved
Mobile and Embedded
-
In my application, I start a foreground service which is a custom service that runs in a separate process, same .so:
public class MyService extends QtService { @Override public int onStartCommand(Intent intent, int flags, int startId) { createNotificationChannel(); // This should be a different .class, correct? Intent notificationIntent = new Intent(this, MyService.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE); notification = new NotificationCompat.Builder(this, CHANNEL_ID) .setContentTitle("Title") .setContentText("Text") .setSmallIcon(R.drawable.notification) .setContentIntent(pendingIntent) .setTicker("Running") .setOngoing(true) .setPriority(NotificationCompat.PRIORITY_LOW) .build(); // Notification ID cannot be 0. startForeground(ONGOING_NOTIFICATION_ID, notification); return START_STICKY; }
Consequently, I'd love this event to raise to the foreground the main activity itself when tapped. My understanding is that I need to pass its .class to the Intent constructor, but I couldn't figure out which one. The app itself is written in C++/QML and I needed no special reason to define a custom Activity subclass, but the default name from AndroidManifest.xml is org.qt.....QtActivity which does not look very specific.
Do I miss something? Or do I need to subclass Activity after all? Could anyone please help?