How to find out if Android is on air

I create a shortcut by sending this broadcast.

Intent shortcutIntent = new Intent(this, AuthenticationActivity.class);
    // create the broadcast
    final Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");

    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, widget.name);
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                    Intent.ShortcutIconResource.fromContext(this, widget.resourceId));
    sendBroadcast(intent);

I am wondering if there is a way to find out if the broadcast was received by the launcher? I show a toast to the user, saying that the shortcut was created successfully, but some launchers may not support this.

+4
source share

Source: https://habr.com/ru/post/1656610/


All Articles