How to start an activity that is defined in different packages from a widget?

I have a widget with clickable Imageview. When I click on the widget, I want it to launch an operation that is in another package. But I am not getting any errors, and the click event also fails. I give my code below.

Intent start = new Intent(context, com.abc.xyz.Start.class);//com.abc.xyz->other package        
PendingIntent pendingIntent = PendingIntent.getActivity(
        context, 0, start, 0);          
RemoteViews views = new RemoteViews(context.getPackageName(),
        R.layout.widget_main);
views.setOnClickPendingIntent(R.id.clickable_image_widget, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetIds, views);

Can anyone help?

+5
source share
1 answer

its not ideal to run the application directly through the package name / class name.

0
source

All Articles