누군가 이러한 유형의 알림에 대해 경험이 있는지 궁금합니다.NotificationCompat 및 setFullScreenIntent()
제 경우에는 내 서비스에서 알림을 실행하고 전체 화면 비디오를 열어야합니다. setFullScreenIntent 메소드는 문서에서 다음과 같이 씁니다.
알림을 상태 표시 줄에 게시하는 대신 실행하려는 의도입니다. 수신 전화 또는 사용자가 명시 적으로 특정 시간으로 설정 한 알람 시계와 같이 사용자의 즉각적인주의를 요하는 매우 중요한 우선 순위 알림과 함께 사용할 경우에만 사용합니다.
그래서 전화가 걸리는 것처럼 작동합니다. 즉 휴대 전화가 잠 들어 있어도 전체 화면으로 알림을 받아야한다는 의미입니다.
그러나 제 경우에는 머리말 알림을 받고, 클릭하면 활동이 열립니다. 문서에서도이 동작에 대해 언급했습니다 ...
일부 플랫폼에서는 시스템 UI가 사용자가 장치를 사용하는 동안이 인 텐트를 실행하는 대신 헤드 업 알림을 표시하도록 선택할 수 있습니다 .
... 알림이 트리거 될 때 자동으로 활동을 여는 방법을 알고 싶습니다. 들어오는 전화 통화 화면과 동일합니다.
이 서비스에서 내 코드는 다음과 같습니다
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Intent notificationIntent = new Intent("android.intent.category.LAUNCHER");
intent.setClassName("com.example.test",
"com.example.test.VideoActivity");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(contentIntent)
.setContentTitle("Video")
.setContentText("Play video")
.setFullScreenIntent(contentIntent, true);
NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());
return Service.START_STICKY;
}
혹시이 문제에 대한 해결책을 찾았나요 제거하려고? – splangi