Alex Cipcigan Ratiu Alex Cipcigan Ratiu - 5 months ago 8
Android Question

Check if the app was launched by a web browser

I have recently built a custom link and when it's tapped it opens my app. How to check if my app was launched by the custom link?

Thanks!

Answer

Check out deep linking on Android: https://developer.android.com/training/app-indexing/deep-linking.html

You can know using Uri data if your Activity has been opened by a custom link.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
}