从浏览器的URL链接打开我的Android应用 [英] Open my Android app from URL link from browser
问题描述
我知道我的问题是被问了很多次这里,但我尝试了所有的答案,仍然有问题 我的问题是,我想我的应用程序被打开扔网址从手机浏览器
i know my question is been asked for many times here but i tried all the answers and still have the problem my problem is that i want my application to be opened throw url from the mobile browser
这是我写的mainfeast.xml文件
here is what i write in the mainfeast.xml file
<activity
android:name=".Login"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<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="" android:scheme="mpay2park" />
</intent-filter>
,仍然解决不了这个问题, 我想知道,我是否应该在Login.java活动写什么或没有,什么是URLthat我应该写这个
and still can't solve this issue what I want to know that if I should write anything in the Login.java activity or not and what is the URLthat I should to write for this
感谢您
推荐答案
您可以使用下面的清单文件,打开 ABC://xyz.com 从浏览器地址栏:
You can use below manifest file to open abc://xyz.com from browser addressbar :
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.sample.openfrombrowser.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleInstance" >
<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="xyz.com"
android:scheme="abc" />
</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="google.co.in"
android:pathPrefix="/"
android:scheme="http" />
<data
android:host="www.google.co.in"
android:pathPrefix="/"
android:scheme="http" />
</intent-filter>
</activity>
</application>
这会问选项(与你的应用程序名称)对话框打开这个网址。
This will ask option(with your application name) in dialog to open this url.
希望因此这会为你工作。
hope so this will work for you.
享受。
这篇关于从浏览器的URL链接打开我的Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!