-1
간단한 알림을 만들려면 어떻게해야합니까? 클릭하면 응용 프로그램이 닫힙니다 (멀티 태스킹)? 감사. 에서 onCreate (에 그런클릭하면 앱을 종료하는 알림을 어떻게 만듭니 까?
Intent intent = new Intent(this, YourClass.class);
intent.putExtra("NotiClick",true);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
Notification Noti;
Noti = new Notification.Builder(this)
.setContentTitle("YourTitle")
.setContentText("YourDescription")
.setSmallIcon(R.mipmap.ic_launcher)
.setContentIntent(pIntent)
.setAutoCancel(true).build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, Noti);
}
) 클래스의이 수행 :
Bundle extras = getIntent().getExtras();
if(extras == null)
{
//not being clicked on
}
else if (extras.getBoolean("NotiClick"))
{
//being clicked
}
완전히에 대한을 (자바, 안드로이드)
가능한 복제본 응용 프로그램을 닫으려면 [알림 표시 줄을 클릭하십시오] (https://stackoverflow.com/questions/9222406/notification-bar-click-to-close-app) –