Passthrough intent filter and activity

Matt Joiner

I have an implicit intent filter that handles magnet: scheme links by opening an intent to view with the default web browser. Currently this has the effect that clicking a magnet link throws the user out of the browser into my activity, which immediately throws them back into the browser with a new URI.

How do I hide the app switch? There's nothing to see on the activity that comes up only to redirect back to the browser.

Pressing back after landing on the new page in the browser, throws the user back to the home screen. I want it to return to the original page where the magnet link was clicked.

Here's the code in onCreate for the handling activity

String uri = "https://some.site";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(browserIntent);

I've tried several flags, and finish(), which haven't had the intended effect. I believe I want to abandon the current task (the one that initiates the browser intent), so that backs will return directly to the previous task. But as mentioned above, currently this just drops the user back to the home screen.

CommonsWare

How do I hide the app switch? There's nothing to see on the activity that comes up only to redirect back to the browser.

Use Theme.Translucent.NoTitleBar to have an invisible activity. Do not call setContentView() in onCreate(), and at the bottom of onCreate(), call finish(). Somewhere before finish(), have your chunk of code from your question.

I believe I want to abandon the current task (the one that initiates the browser intent), so that backs will return directly to the previous task. But as mentioned above, currently this just drops the user back to the home screen.

Since you did not write the Web browser, task management is outside of your control, really. If the Web browser launching your activity puts you in a separate task, that's the Web browser's decision to make. You have no way of saying "no, I wish to remain in the Web browser's task", AFAIK. And note that the behavior here may vary by browser.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Passthrough intent filter and activity

From Dev

Android intent filter restart Activity?

From Dev

Activity / intent filter for a specific API level

From Dev

Activity / intent filter for a specific API level

From Dev

How to open Activity via intent-filter and what is the use of intent-filter?

From Dev

Is it possible to register two actions within one <intent-filter> for Activity

From Dev

Android intent filter - check if another app started activity

From Dev

What is the difference between intent filter in activity and broadcast receiver?

From Dev

How to add a space in action of an intent filter of a activity In Android Manifest File

From Dev

Activity with "android.intent.action.SEND" intent filter is not showing up in list when sharing photo from stock Google Photos app

From Java

Android - Adding at least one Activity with an ACTION-VIEW intent-filter after Updating SDK version 23

From Dev

Intent filter to match pattern data from URL query, when opening links in activity

From Dev

How to close previous activities when activity launch by intent-filter happens?

From Dev

Get the Intent that resumes the activity

From Dev

In login activity, intent is not working

From Dev

How to receive Intent in Activity

From Dev

back to previous activity with intent

From Dev

Intent not working - Activity not found

From Dev

Android Intent, Fragment and Activity

From Dev

Intent JSONObject to another activity

From Dev

Camera Intent destroys Activity

From Dev

startActivity(intent) is not opening activity

From Dev

using multiple intent in an activity

From Dev

Launch activity with intent

From Dev

Bring activity to front with intent

From Dev

Starting activity intent in AndEngine

From Dev

Android Intent, Fragment and Activity

From Dev

Activity is destroyed on intent creation

From Dev

Android Intent Activity Logic?

Related Related

  1. 1

    Passthrough intent filter and activity

  2. 2

    Android intent filter restart Activity?

  3. 3

    Activity / intent filter for a specific API level

  4. 4

    Activity / intent filter for a specific API level

  5. 5

    How to open Activity via intent-filter and what is the use of intent-filter?

  6. 6

    Is it possible to register two actions within one <intent-filter> for Activity

  7. 7

    Android intent filter - check if another app started activity

  8. 8

    What is the difference between intent filter in activity and broadcast receiver?

  9. 9

    How to add a space in action of an intent filter of a activity In Android Manifest File

  10. 10

    Activity with "android.intent.action.SEND" intent filter is not showing up in list when sharing photo from stock Google Photos app

  11. 11

    Android - Adding at least one Activity with an ACTION-VIEW intent-filter after Updating SDK version 23

  12. 12

    Intent filter to match pattern data from URL query, when opening links in activity

  13. 13

    How to close previous activities when activity launch by intent-filter happens?

  14. 14

    Get the Intent that resumes the activity

  15. 15

    In login activity, intent is not working

  16. 16

    How to receive Intent in Activity

  17. 17

    back to previous activity with intent

  18. 18

    Intent not working - Activity not found

  19. 19

    Android Intent, Fragment and Activity

  20. 20

    Intent JSONObject to another activity

  21. 21

    Camera Intent destroys Activity

  22. 22

    startActivity(intent) is not opening activity

  23. 23

    using multiple intent in an activity

  24. 24

    Launch activity with intent

  25. 25

    Bring activity to front with intent

  26. 26

    Starting activity intent in AndEngine

  27. 27

    Android Intent, Fragment and Activity

  28. 28

    Activity is destroyed on intent creation

  29. 29

    Android Intent Activity Logic?

HotTag

Archive