una navegador linking link google enlaces desde como chrome app aplicaciones abrir android

navegador - deep link android



Abrir un enlace del navegador a través de la notificación no funciona (2)

Mi problema es el siguiente:

Estoy publicando una notificación en la barra de notificaciones, y he puesto un enlace URI en la intención que se envía con ella. Tan pronto como hago clic en la notificación, aparece un cuadro de diálogo de lo que quiero hacer, pero muestra basura como información de la aplicación, escáner de código de barras, diálogo de llamada. en lugar de navegador.

Les presento mi código:

Intent notificationIntent = new Intent(Intent.ACTION_VIEW); PendingIntent contentIntent = PendingIntent.getActivity(contexta, 0, notificationIntent, 0); notificationIntent.setData(Uri.parse("http://www.google.com")); notification.setLatestEventInfo(contexta, contentTitle, contentText, contentIntent); mNotificationManager.notify(970970, notification);

Así que probablemente no estoy pensando en la dirección correcta. ¿Debería tal vez insertar un intento y tener un controlador en mi propia aplicación para crear un nuevo intento para el navegador? Pero eso sería extraño, ¿por qué Android no maneja mi intento inicial correctamente entonces?

Como siempre, cualquier ayuda es muy apreciada.

Gracias, Rohan.


Creo que el problema es que está configurando los datos en "notificationIntent" después de haberlos dado a PendingIntent.

Prueba esto:

Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); PendingIntent contentIntent = PendingIntent.getActivity(contexta, 0, notificationIntent, 0); notification.setLatestEventInfo(contexta, contentTitle, contentText, contentIntent); mNotificationManager.notify(970970, notification);

O prueba esto:

Intent notificationIntent = new Intent(Intent.ACTION_VIEW); notificationIntent.setData(Uri.parse("http://www.google.com")); PendingIntent contentIntent = PendingIntent.getActivity(contexta, 0, notificationIntent, 0); notification.setLatestEventInfo(contexta, contentTitle, contentText, contentIntent); mNotificationManager.notify(970970, notification);


es trabajo para mi

Intent notificationIntent = new Intent(Intent.ACTION_VIEW); notificationIntent.setData(Uri.parse("http://www.google.com")); PendingIntent pi = PendingIntent.getActivity(context, 0, notificationIntent, 0); // Resources r = getResources(); Notification notification = new NotificationCompat.Builder(context) .setTicker("yortext") .setSmallIcon(android.R.drawable.ic_menu_report_image) .setContentTitle("yortext") .setContentText("sdsd") .setContentIntent(pi) .setAutoCancel(true) .build(); NotificationManager notificationManager2 = (NotificationManager) context.getSystemService(Service.NOTIFICATION_SERVICE); notificationManager2.notify(0, notification);