Android widget doesn't open website after system reboot

This is the first time I have coded Java.

I am making an application that is meant to create a widget whose name and web page is determined during its creation. The application otherwise works except when you restart the device.

The name of the button is retained but it no longer opens the web page. Below is the code:

WidgetProvider

public class TestAppWidgetProvider extends AppWidgetProvider{

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        Intent intent = new Intent(context, TestAppWidgetProvider.class);

        for (int appWidgetId : appWidgetIds) {

            @SuppressLint("UnspecifiedImmutableFlag") PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

            SharedPreferences prefs = context.getSharedPreferences(SHARED_PRES, Context.MODE_PRIVATE);
            String weblink = prefs.getString(WEB_LINK + appWidgetId, "http:123.456.789.1");
            String text = prefs.getString(KEY_BUTTON_TEXT + appWidgetId, "Press me");

            RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.test_widget);
            views.setOnClickPendingIntent(R.id.test_widget_button, pendingIntent);
            views.setOnClickPendingIntent(R.id.edit_link, pendingIntent);
            views.setCharSequence(R.id.test_widget_button, "setText", text);
            views.setCharSequence(R.id.edit_link, "setText", weblink);

            appWidgetManager.updateAppWidget(appWidgetId, views);

        }
    }
}

and WidgetConfig:

public class TestAppWidgetConfig extends AppCompatActivity {
    public static final String SHARED_PRES = "prefs";
    public static final String KEY_BUTTON_TEXT = "keyButtonText";
    public static final String WEB_LINK = "webLink";

    private int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
    private EditText editTextButton;
    private EditText editWebLink;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_app_widget_config);
        Intent configIntent = getIntent();
        Bundle extras = configIntent.getExtras();
        if (extras != null) {
            appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
                    AppWidgetManager.INVALID_APPWIDGET_ID);
        }

        Intent resultValue = new Intent();
        resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        setResult(RESULT_CANCELED, resultValue);

        if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
            finish();
        }

        editTextButton = findViewById(R.id.edit_name);
        editWebLink = findViewById(R.id.edit_link);
    }

    public void confirmConfiguration(View v) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
        
        String buttonText = editTextButton.getText().toString();
        String weblink = editWebLink.getText().toString();
        
        SharedPreferences prefs = getSharedPreferences(SHARED_PRES, MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString(KEY_BUTTON_TEXT + appWidgetId, buttonText);
        editor.putString(WEB_LINK + appWidgetId, weblink);
        editor.apply();
        
        Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http:" + weblink));
        @SuppressLint("UnspecifiedImmutableFlag") PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);

        RemoteViews views = new RemoteViews(this.getPackageName(), R.layout.test_widget);
        views.setOnClickPendingIntent(R.id.test_widget_button, pendingIntent);
        views.setOnClickPendingIntent(R.id.edit_link, pendingIntent);
        views.setCharSequence(R.id.test_widget_button, "setText", buttonText);
        views.setCharSequence(R.id.edit_link, "setText", weblink);
        
        appWidgetManager.updateAppWidget(appWidgetId, views);

        Intent resultValue = new Intent();
        resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        setResult(RESULT_OK, resultValue);
        finish();
    }
}
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum