2013-07-27 9 views

답변

0

Android Notifications - Tutorial 당신이 원하는 것을 달성하는 데 분명 도움이 될 것입니다.

아래에서 원하는 것을 발췌 한 것입니다. 다음 기능을 호출 할 수 있습니다.

public void createNotification(View view) { 
    // Prepare intent which is triggered if the 
    // notification is selected 
    Intent intent = new Intent(this, NotificationReceiverActivity.class); 
    PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); 

    // Build notification 
    // Actions are just fake 
    Notification noti = new Notification.Builder(this) 
     .setContentTitle("Title") 
     .setContentText("Subject").setSmallIcon(R.drawable.icon) 
     .setContentIntent(pIntent) 
     .addAction(R.drawable.icon, "Call", pIntent) 
     .addAction(R.drawable.icon, "And more", pIntent).build(); 
    NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); 
    // Hide the notification after its selected 
    noti.flags |= Notification.FLAG_AUTO_CANCEL; 

    notificationManager.notify(0, noti); 

    } 

다운로드 관리자를 시작하려면 그에 따라 기능을 조정해야 할 수 있습니다. 자세한 내용은 자습서 링크를 확인하십시오. 또한 도움이 될 수 있습니다 기타 관련 답변이 있습니다

Start downloading on Notification bar click in android

Android how to start an apk download from the notification drawer

open file on click of notification?

Opening activity after clicking push notification android 질문입니다.

희망이 도움이됩니다.

관련 문제