I have an android notification bar which uses a remote view. I have 2 buttons on there to play and pause audio and also an icon to return to the application. I want to be able to click the icon (or anywhere but on the 2 buttons) and return to the application. Here is my code
Intent returnIntent = new Intent(_context, SplashScreenActivity.class);
returnIntent.setAction(Intent.ACTION_MAIN);
returnIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent remoteViewPendingIntent = PendingIntent.getActivity(_context,1, returnIntent,0);
remoteView.setOnClickPendingIntent(R.id.btnAppIcon, remoteViewPendingIntent);
This all works fine in the emulator on Android 4.1. When the icon in the notification is pressed it returns successfully to the app. However on Android 4.0.3 on a Samsung S3 the Activity launches in the background but the notification screen is not hidden. I want the notification screen to be cleared once the icon is selected. I have tried using the Notification.FLAG_AUTO_CANCEL in the notification but that did not fix the issue. Any help would be greatly appreciated.