通知をタップしてアプリを開いたときにPlay Marketを開きます。 火災報知を使用しています。開かれていない場合は、通知をタップしてマーケットを再生
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
showNotification(remoteMessage.getNotification().getBody());
}
private void showNotification(String message) {
String textFirebaseEn = getResources().getString(R.string.notification_text_firebase_checking);
if (message.equals(textFirebaseEn)) {
String localTitle = getResources().getString(R.string.notification_title_firebase);
String localText = getResources().getString(R.string.notification_text_firebase);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.drawable.avatar_notification)
.setContentTitle(localTitle)
.setContentText(localText)
.setAutoCancel(true)
.setSound(defaultSoundUri);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(PLAY_MARKET));
builder.setContentIntent(PendingIntent.getActivity(getApplicationContext(), 0, intent, 0));
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, notification);
}
}
何か間違って教えてください。
代わりにURIが空白のアクティビティを作成し、その空白の活動にcontentIntentをリダイレクトし、その空白の活動からあなたのプレイストアのリダイレクトを処理し、直接市場を使用します。 – Kunu