我有一个前台通知服务。 当用户点击前景通知时如何启动活动?
我尝试过:
// CREATE NOTIFICATION FOREGROUND
Intent notificationIntent = new Intent(getApplicationContext(), HomeActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0);
Notification notification = new NotificationCompat.Builder(getApplicationContext())
.setContentTitle("Title")
.setTicker("Test service")
.setContentIntent(contentIntent)
.setContentText("text...").build();
startForeground(1, notification);
//======================================================================================
我需要在用户点按前台通知时启动HomeActivity。