i have a service which will display a notification. the notification is being displayed correctly, but nothing happens when I click on the nofitification. It should open an activity in my app. here's my code:
public class ServiceCheckExpensesRecurring extends Service{
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
int mNotificationId = 001;
Intent myIntent = new Intent(this, MenuDashboard.class);
myIntent.setAction(Intent.ACTION_VIEW);
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pIntent = PendingIntent.getActivity(getBaseContext(), 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder n = new NotificationCompat.Builder(this)
.setContentTitle("New mail from " + "test@gmail.com")
.setContentText("Subject")
.setSmallIcon(R.drawable.common_signin_btn_icon_light)
.setContentIntent(pIntent)
.setAutoCancel(true);
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(mNotificationId, n.build());
return Service.START_NOT_STICKY;
}
}
FYI, MenuDashboard is a fragment (if it helps). And i'm using my sony experia mini with ICS