Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8964003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:29:12+00:00 2026-06-15T16:29:12+00:00

I have an android app that register a custom url scheme (let’s say app://)

  • 0

I have an android app that register a custom url scheme (let’s say app://)

In the onResume() method of my main activity I get data from the url by calling getIntent().getData().

When I browse to a web page containing such a link (like app://action/1234) then getIntent().getData() return the info I need to take appropriate action. That’s fine.

Now I want to have a WebView in my app that does the same. Here’s my code :

WebView banner = ...
banner.setWebViewClient(new WebViewClient() {

    @Override
    public void onLoadResource(WebView view, String url) {

        if (url.startsWith("app://")) {

            try {
                Intent i = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
                startActivity(i);

                return true;

            } catch (URISyntaxException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return false;

        }
    }
}

When I click on the link in the WebView, the onResume() method of the main activity is called BUT getIntent().getData() returns null.

I guess

Intent i = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
startActivity(i);

is not the good way to do it.

How should I do to reproduce the same event that happens when I click a link in the browser ?

EDIT:

My activity has android:launchMode="singleTop" and it seems to be the cause of my problem but if I don’t set the launch mode then another copy of the activity is launched (I don’t want that). I tried to handle the intent by overriding onNewIntent() and in the intent given to it I can see the data. But I want my app to react in the same manner with it’s launched from its inside or from another app then

Is it safe to do this ? :

@Override
public void onNewIntent(Intent intent) {
    getIntent().setData(intent.getData());
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:29:13+00:00Added an answer on June 15, 2026 at 4:29 pm
    Intent i=new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    

    should do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say you have a web app related Android app that requires the user
Let's say i have an android device that has some extra buttons on it,
I have Android client app that communicates with server using Socket . On my
I have an android app that I am trying to launch and it gives
I have an Android app that has an Application class and I have another
I have an android app that plays audio from the application class. I have
I have an Android app that I had working a few months ago which
I have an Android app that begins by displaying a dialog. When I set
I started developing an android app that have to interact with MMS attachements, in
I have a 2.3.3 android app that I am developing that I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.