In react native application, for android platform creating widget and on tap of it I need to open HomePage. or when I tap on widget I should able to send data to react native app that from widget application is opened so through this way at react native side able to open Home page. Below is my code for widget class to open app on tap of the widget. Widget.java
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
Intent intent = new Intent(context, MainActivity.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent,
0;
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
views.setOnClickPendingIntent(R.id.appwidget_text, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
widget reference links : https://github.com/andrepimenta/react-native-create-widget-tutorial any work around reference will be Helpful, thank you in advance !