나는 실제로 안드로이드에서 notifications
와 함께 일하고있다.android에서 알림을 클릭 한 후 앱에 새보기를 추가 하시겠습니까?
응용 프로그램 테스트를 수행하려면 the guide on android.developer을 따르십시오.
알림을 생성합니다. 정상적으로 작동합니다. 클릭하면 알림 탭에서 알림을 제거하고 내 활동으로 이동합니다. 여기
내가 그렇게하는 데 사용하는 코드입니다 :
public void createSimpleNotification() {
NotificationCompat.Builder mNotifBuilder = new NotificationCompat.Builder(this.getApplicationContext())
.setSmallIcon(R.drawable.ic_notif).setContentTitle("Simple notif").setContentText("Welcome on our app, click here");
Intent resultIntent = new Intent(this, MainActivity.class);
TaskStackBuilder mStackBuilder = TaskStackBuilder.create(this.getApplicationContext());
mStackBuilder.addParentStack(MainActivity.class);
mStackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = mStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mNotifBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotifManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotifManager.notify(0, mNotifBuilder.build());
}
난 단지가 내 MainActivity
과 Button
. 버튼을 클릭하면 알림이 나타나고 알림을 클릭하면 MainActivity로 돌아옵니다. 내가 통지를 클릭 한 후 내 MainActivity UI
을 업데이트 할
:
여기 내 문제입니다. 알림을 클릭 한 후 알림 텍스트를 표시하는 Dialog
을 만들어야합니다.
알림을 클릭 한 후 Activity
을 수정하고 View
을 새로 추가하려면 어떻게해야합니까?
을에 그것을 처리 나는 당신과 동의하지만 어떻게 통지에 onClick 내보기에 액세스 할 수 있습니까? – Androzr
활동에보기를 만듭니다. 그냥 정적 클래스 변수로 만드십시오. 'ActivityWithView.myNotificationView' (예 : – PKlumpp
)를 통해 액세스 할 수 있습니다. 네가하는 말을 이해하지만 알림이 클릭되었는지 어떻게 알 수 있습니까? – Androzr