I have already opened my android application. I used url scheme, so that my app can be opened from the users email. But if i try to open my application from clicking email link from the web browser, it will open that application in separate window. (Please see my attached screen short picture) .
How to avoid my application to open twice separately?
<activity
android:name="com.mYs3.MainActivity.flash_screen"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="mYs3" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
try this line in your activity block in manifest
android:launchMode="singleTask"
Related
Launch app when click on url if app installed on device. if app not installed on device, open playstore.
<activity android:name=".ui.NewsCardActivity">
<intent-filter>
<data android:scheme="app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
You have to deep link your app, add following lines in activity (Manifiest.xml) which you want to launch
<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="screen" android:scheme="appname"/>
</intent-filter>
in browser when ever you click appname://screen your app activity will be launched,
replace appname and screen as per your requirement
Note if you type this url in browser it will search in google ,for this to work you have to write link in html page
Some text
If not working the add android:exported="true" in activity
<activity
android:name=".activity.MainActivity"
android:exported="true">
this questions has been asked in a similar way like a hundred times, though I still cannot find a proper answer to get my app to work the way I want. Maybe this is not possible which would be a valid answer of course.
I have an activity defined as follows in my app:
<activity
android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask" >
<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="MyActivityCustomUrlScheme" />
</intent-filter>
</activity>
When I start my App in the emulator and then open the browser and type a URL like:
MyActivityCustomUrlScheme://mycustomHost.com?someOptions
the only thing happening is that chrome tries googling for it, which is not what I want. If I send myself an SMS with this scheme, the scheme inside is not recognised as such and not clickable :(
I want to do that, because I already have an iOS App in the store, which uses the scheme MyActivityCustomUrlScheme://mycustomHost.com?someOptions and it would be a lot of hazel to change it everywhere, as users get this url send by email or SMS. I'd be really thankful if someone can help me out on this problem.
Try to use definition of host :
<activity android:name="MyActivity"
android:label="MyActivityLabel"
android:launchMode="singleTask">
<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="MyActivityCustomUrlScheme" android:host="mycustomHost.com" />
</intent-filter>
</activity>
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.
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.
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.