App does not open when run scheme on Chrome/Firefox - android

I want to start my Android app by using scheme, this is my code:
<activity
android:name="com.myapp.SplashScreenActivity"
android:alwaysRetainTaskState="true"
android:label="#string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.myhost.com"
android:pathPrefix="/company/"
android:scheme="http" />
<data
android:host="myhost.com"
android:pathPrefix="/company/"
android:scheme="http" />
</intent-filter>
</activity>
Then run : myhost.com/company/ on browsers and results:
Default internet browser: App open normally
Chrome: does not work
Firefox: does not work.
I don't know how to solve it, please help me and explain me about it.

You should not use "http" as the scheme, because Chrome and Firefox can handle this kind of URL they will not call other app to handle it. Instead, you can use a self-defined scheme such as "myprotocol" which can not be handled by those browser, they will call your app to handle it. You can run "myprotocol://myhost.com/company/" on Chrome to test it.

Related

Android 6 - cannot open app url from chrome

I had setup intent filter in manifest.xml, such as follows:
<activity
android:name="indexgifto.android.ui.viewcontrollers.SplashScreenActivity"
android:label="#string/application_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustNothing"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:screenOrientation="portrait" >
<intent-filter>
<data android:scheme="gifto"/>
<data android:scheme="http" />
<data android:host="www.gifto.net"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When I execute 'am start http://www.gifto.net/go.php?c=xlh201' application successfully opens with required data. But, when same URL opened via Chrome, just server page opens. In the android 4 in both cases my app was able to start from this url. What I must fix in android 6?
Chrome for Android, versions 25 and later, you should implement a user gesture to launch the app via a custom scheme, or use the “intent:” syntax described in this article.
https://developer.chrome.com/multidevice/android/intents
this worked for me you to try once if worked for u.
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.youtube.com" android:scheme="http" android:pathPrefix="http"></data>
</intent-filter>

Launch Android application from browser

I have a little problem.
I have an Android Activity, and I want to run it from one link on the browser.
This is what how I have declared my Activity on the Manifest file:
<activity android:name=".Wul4"
android:windowSoftInputMode="adjustPan"
android:configChanges="keyboardHidden|orientation"
android:launchMode="singleInstance"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wul4" android:host="com.wul4.wul4"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
On the webApp, the link to launch the application is the following one:
wul4://com.wul4.wul4?codOperacion="+respuestaActual.idOperacion
The point is that It is working from the following browsers: "Opera" and "Google Chrome", but it is not working for the rest..........(for instance, it is not working on the default browser of the phone).
Anyone knows why???
Thanks a lot!
Try this one, using HTTP instead of your own schema:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="com.wul4.wul4"
android:scheme="http:" />
</intent-filter>
When a link with this domain is clicked in an Android device, the user is presented with a dialog to choose between your App (if installed) or the Browser.

Android Intent-Filter for Multi Screen

I want to launch my application from web browser in Android using Intent-Filter based on scheme, host in the DATA tag like this.
<activity android:name=".activity.LogoActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.phone.MainActivityPhone" android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my" android:host="mystore" />
</intent-filter>
</activity>
<activity android:name=".activity.tablet.MainActivityTablet" android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my" android:host="mystore" />
</intent-filter>
</activity>
As you see, There are two Main Activities for phone and tablet, and in LogoActivity determine which Main Activity will be opened by screen size. But the problem is when user clicks my://mystore link in web browser, there are two choices to launch that MainActivtyPhone and MainActivityTablet.
What I want is there is only one proper intent-filter works for uri my://mystore .
Any help? Thanks.
On the first run of your application, use PackageManager to disable the activity you do not want to use.
Please do not invent custom schemes. Please use HTTP URLs instead:
<data android:scheme="http" android:host="yourdomain.com" android:path="/something/or/another" />
That way, you can actually put a real Web page at http://yourdomain.com/something/or/another, so if somebody gets your link but does not have your app installed, they will see your Web page, instead of getting an error.
Also, please remove android:configChanges, or handle all configuration changes.

Could not launch application by calling a URL from Android Browser

There are many answers in stackoverflow showing how to lauch app from a web browser ,but I am not sure what went wrong with my code, that never seems to be doing the intended.
I am trying to launch my app by a URL from any other app like web browser,initially
my manifest file looks like this
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
And When I typed http://ebay.com in the browser that never started my app.Obviously,how does the browser know about my app?,then i tried the other way around and added another Activity called MyActivity and altered the manifest file as
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MyActivity">
<intent-filter>
<data android:scheme="http" android:host="ebay.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
and tried in my Main Activity
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://mycityway.com")));
Thus producing the intended result.I can also start another application Activity using this method.
But most of the answers here says that the later is possible.What is the mistake i am doing,I couldn't launch my app from browser.Please guide me.
And When I typed http://ebay.com in the browser that never started my
app.
It gets started when a matching link is clicked not when you type the url in the browser.
Try it by sending yourself an email containing http://ebay.com and click the link in the email application.

How to start app from Android browser, when I type in "myapp://" in address bar

I need the browser to start my app whenever I enter the "myapp://blah.com/a?b=1&c=2" in the browser. I have searched a lot on this topic, but non of the answers really helped me. Could you please help to understand what I'm missing?
<activity android:name=".MyAppMain"
android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
After installation from Eclipse (Run As Android application) my app can work ok on its own, but when I type in "myapp://blah.com/a?b=1&c=2", the browser is simply googling for this string. Could you point out what else I'm missing? Do I need after installation to somehow register in the system that I want to handle "myapp://" urls?
I have done this using the
<activity android:name=".ReceiveInviteActivity">
<intent-filter >
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:scheme="appname"
android:host="project.example.com"
/>
</intent-filter>
</activity>
And activity
if (Intent.ACTION_VIEW.equals(action)) {
final List<String> segments = intent.getData().getPathSegments();
Log.d("LISTARRAY",segments.toString());
String idString = segments.get(0);
Log.d("LISTITEM",segments.get(0).getClass().toString());
String friendId = idString.substring((idString.indexOf("="))+1);
Log.d("friendId!",friendId);
I hope this will help you.
Check out this answer for why it isn't working: Android custom URI scheme incorrectly encoded when type in browser
Basically, the default Android browser only accepts certain URI schemes, so your custom one won't work when typed directly into the URL bar.

Categories

Resources