मैं जब पुश अधिसूचना पर उपयोगकर्ता क्लिक करें, मैं stackoverflow खोज एक यूआरएल के साथ ब्राउज़र को खोलने के लिए कोशिश कर रहा हूँ और मैं इसब्राउज़र खोलना
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
लगता है, लेकिन यह मेरे लिए काम नहीं करता है, जब मैंने कहा कि अधिसूचना प्रकट नहीं होती है, मैंने इसे डीबग किया है और यह केवल क्लास फ़ाइल संपादक को कोई त्रुटि या कुछ भी नहीं फेंक देता है। जो जब उपयोगकर्ता अधिसूचना क्लिक करता है द्वारा सक्रिय किया जाएगा -
इसकोड
public void mostrarNotificacion(Context context, String body,String title, String icon, String url,String superior)
{
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager notManager = (NotificationManager) context.getSystemService(ns);
int icono = R.drawable.mydrawable;
CharSequence textoEstado = superior;
long hora = System.currentTimeMillis();
Notification notif = new Notification(icono, textoEstado, hora);
Context contexto = context.getApplicationContext();
CharSequence titulo = title;
CharSequence descripcion = body;
PendingIntent contIntent;
if(url.equalsIgnoreCase("NULL"))
{
Intent notIntent = new Intent(contexto,MainActivity.class);
contIntent = PendingIntent.getActivity(
contexto, 0, notIntent, 0);
}
else
{
// Intent i = new Intent(Intent.ACTION_VIEW);
//i.setData(Uri.parse(url));
// contIntent = PendingIntent.getActivity(contexto, 0, i, 0);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
}
// notif.setLatestEventInfo(contexto, titulo, descripcion, contIntent);
//AutoCancel:
notif.flags |= Notification.FLAG_AUTO_CANCEL;
//send notif
notManager.notify(1, notif);
}
आप कहां 'mostrarNotificacion'' कहां कहते हैं Thod? – Eran
अब यह काम कर रहा है ड्रोर फिचमैन के लिए धन्यवाद, वैसे भी मैं मैसेज – D4rWiNS
पर विधि को कॉल करता हूं यहां एक वर्कअराउंड है http://stackoverflow.com/questions/39285006/android-lock-screen-notification-is-not-able-to-open- ब्राउज़र-ऑन-डबल-टैपिंग –