I have a widget class and a service class updating the widget.
I have added in the widget class in onUpdate() the following code:
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.countdownwidget);
Intent Intent1 = new Intent(Intent.ACTION_MAIN);
Intent1.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent1 = PendingIntent.getActivity(context, 0, Intent1, 0);
views.setOnClickPendingIntent(R.id.button1, pendingIntent);
Intent Intent2 = new Intent(Intent.ACTION_MAIN);
Intent2.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 0, Intent2, 0);
views.setOnClickPendingIntent(R.id.button2, pendingIntent2);
And I have also added the following code in the widget service in the onStart()
Intent Intent1 = new Intent(Intent.ACTION_MAIN);
Intent1.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent1 = PendingIntent.getActivity(getApplicationContext(), 0, Intent1, 0);
remoteView.setOnClickPendingIntent(R.id.button1, pendingIntent1);
Intent Intent2 = new Intent(Intent.ACTION_MAIN);
Intent2.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent2 = PendingIntent.getActivity(getApplicationContext(), 0, Intent2, 0);
remoteView.setOnClickPendingIntent(R.id.button2, pendingIntent1);
The problem I am having is that once the implicit intent registers the app to launch on button1, the button2 is identical to button1. How can i make the 2 intents behave differently? i.e register and launch different apps.Its working with one button, but the other button launches the same thing of the first button.I have have been looking to get this to work for the last week, reading things all over but with no result. I would appreciate your help. Thanks.