Android12中DeepLink通知无法工作(用户点击通知时无法打开应用程序)。
创始人
2024-09-30 22:00:43
0
  1. 确保在AndroidManifest.xml文件中正确配置了intent-filter。以下是一个示例:

    
        
        
        
        
    

具体的数据应该根据您的Deep Link URI来配置(例如host,pathPrefix和scheme)。

  1. 如果您使用的是PendingIntent,则需要确保添加了FLAG_ACTIVITY_NEW_TASK标志:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
  1. 确保在onNewIntent()方法中处理Deep Link:
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        // handle Deep Link here
    }
}
  1. 如果您使用的是NotificationCompat.Builder,则需要确保配置了正确的PendingIntent:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
        .setSmallIcon(R.drawable.ic_notification)
        .setContentTitle("Title")
        .setContentText("Content")
        .setContentIntent(pendingIntent)
        .setAutoCancel(true)
        .build();
NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, notification);

这些步骤应该能够解决Deep Link通知在Android 12中无法工作的问题。

相关内容

热门资讯

玩家交流!wepoker分析,... 玩家交流!wepoker分析,约局吧德州可以透视吗,高科技教程(有挂辅助);致您一封信;亲爱约局吧德...
透视有挂!aapoker辅助插... 透视有挂!aapoker辅助插件工具(透视)总是真的是有挂(详细辅助曝光教程)1、aapoker辅助...
一分钟快速了解!pokemmo... 一分钟快速了解!pokemmo手机脚本,newpoker脚本,wpk教程(有挂软件);最新版2024...
透视新版!hhpoker脚本(... 透视新版!hhpoker脚本(透视)切实是真的有挂(详细辅助wepoke教程)该软件可以轻松地帮助玩...
一分钟快速了解!wepoker... 一分钟快速了解!wepoker私局代打,wepoker怎么买辅助,黑科技教程(有挂软件);《WPK辅...
透视辅助!wepoker可以透... 透视辅助!wepoker可以透视码(透视)确实是有挂(详细辅助必胜教程);辅助器中分为三种模型:软件...
每日必看!wepoker看底牌... 每日必看!wepoker看底牌,约局吧德州有挂吗,2025版教程(有挂神器);人气非常高,ai更新快...
透视黑科技!智星德州辅助译码插... 透视黑科技!智星德州辅助译码插件靠谱吗(透视)竟然真的有挂(详细辅助2025教程)1、实时智星德州辅...
分享个大家!大菠萝免费辅助器,... 分享个大家!大菠萝免费辅助器,aapoker透视怎么用,详细教程(有挂技巧)是一款可以让一直输的玩家...
透视规律!wepoker可以透... 透视规律!wepoker可以透视码(透视)其实真的是有挂(详细辅助安装教程)1. ai辅助创建新账号...