I have one Android application, when it runs a service, I want to show the notification on the status bar. Then the user could navigate to other application by pressing HO
Another way to launch your package intent.
private void NotificationwithLaucherSelfPackage(Context context , int notification_id){
Notification noti = new Notification.Builder(context)
.setContentTitle("Your Title")
.setContentText("Your Text")
.setSmallIcon(R.drawable.abc_ic_menu_share_mtrl_alpha)
.setContentIntent(PendingIntent.getActivity( context ,notification_id , getLauncherIntent(context) , PendingIntent.FLAG_UPDATE_CURRENT))
.build();
NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
}
private Intent getLauncherIntent(Context context){
return context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
}