By first method you mean adding the android.permission.QUERY_ALL_PACKAGES permission, right?
It is basically in our all interest to give apps on our android devices only those permissions that are really required. Otherwise, in case each app has all permissions, you wont be able to tell if some of them are now spying on your phone calls or maybe tracking what apps you are having installed - where the latter would be doable using the QUERY_ALL_PACKAGES permission.
Therefore Android ranks this permission as “high risk” / “sensitive” and only allows it to be used if actually required by your app. This means, when just using it as a shortcut to open links, your app will pretty likely never be approved to be published on the play store.
You can read more about it here, as @BOB.cat wrote already:
Here a quote (from link above) explaining further when the usage of this permission would be allowed:
To use this permission, your app must fall within permitted uses below, and have a core purpose to search for all apps on the device. You must be able to adequately justify why a less intrusive method of app visibility will not sufficiently enable your app’s policy-compliant user-facing core functionality.
Core functionality is defined as the main purpose of the app. Without this core ability to search for all apps on the device, the app is “broken” or becomes unusable. The core functionality, as well as any core features that comprise this core functionality, must all be prominently documented and promoted in the app’s description.