2017-06-27 9 views
0

私は音楽プレーヤーにメディア通知とロック画面通知を実装しました。ロック画面の通知をクリックしている間、ユーザーにパスワードを尋ねる方法とアプリケーションを開く方法。通知をクリックしているときにアプリケーションを開く方法は?

また、メディアの通知をクリックしている間は、アプリケーションを開いています。しかし、通知バーを閉じる方法、または通知バー全体を隠す方法Media Notification image

どのファイルディレクトリの音楽ファイルをクリックしている間に "open with"で自分のアプリケーションの提案を表示する方法。

答えて

0

パスワードを尋ねることはどういう意味ですか?パスワードを要求するアクティビティを開くだけです。あなたがマニフェストに意図-フィルタを定義する必要があります「で開く」についてはOpen application after clicking on Notification

NotificationManager notificationManager = (NotificationManager) context 
     .getSystemService(Context.NOTIFICATION_SERVICE); 
Notification notification = new Notification(icon, message, when); 

Intent notificationIntent = new Intent(context, HomeActivity.class); 

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP 
     | Intent.FLAG_ACTIVITY_SINGLE_TOP); 

PendingIntent intent = PendingIntent.getActivity(context, 0, 
     notificationIntent, 0); 

notification.setLatestEventInfo(context, title, message, intent); 
notification.flags |= Notification.FLAG_AUTO_CANCEL; 
notificationManager.notify(0, notification); 
関連する問題