I am not an Android developer, but I need to make an application, so since I know some HTML / JavaScript / CSS, I decided to use PhoneGap (Cordova). I use a plugin called the download manager ( github ), which downloads files and displays a progress notification. Everything works, but I want to return me to the main activity of my application when I click on a notification, but this does not happen.
This file is the file responsible for the download and notification, the following code:
intent = new Intent(); intent.putExtra("cancel_download", 1); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); pend = PendingIntent.getActivity(cordova.getActivity(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); mNotifyManager = (NotificationManager) cordova.getActivity().getSystemService(Activity.NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(cordova.getActivity()) .setSmallIcon(android.R.drawable.stat_sys_download) .setContentTitle(notificationTitle) .setTicker(ticker) .setContentIntent(pend) .setContentText("0% - " + fileName); mNotificationId = new Random().nextInt(10000); ... ...
I can not get it to work, when I click the notification, nothing happens. What's wrong? Sorry for the bad english.
java android cordova
Franz tesca
source share