我在http://developers.google.com/+/mobile/android/share/deep-link上尝试使用Google+中的深层链接到Android应用.
我可以分享到Google+.帖子中的链接是"可点击的"(在触摸期间突出显示),但在发布时不做任何操作.此外,帖子包含可疑的"未定义"文本行.
样本http://raw.github.com/concreterose/TestDeepLink/master/README_ASSETS/sample_share.png
我在Google Developers Console项目凭据中启用了深层链接.
我正在使用使用Scopes.PLUS_LOGIN创建的已登录PlusClient,通过以下方式发布:
Intent shareIntent = new PlusShare.Builder(this, plusClient)
.setText("Testing deep link")
.setType("text/plain")
.setContentDeepLinkId("deeplink",
"title",
"description",
Uri.parse(thumbnailUrl))
.getIntent();
startActivityForResult(shareIntent, 0);
Run Code Online (Sandbox Code Playgroud)
我不确定我是否需要所有这些,同时试图让我的工作变得有效:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Run Code Online (Sandbox Code Playgroud)
处理活动(作为清单中的第一个活动):
<activity android:name=".ParseDeepLinkActivity">
<intent-filter>
<action android:name="com.google.android.apps.plus.VIEW_DEEP_LINK" />
<data android:scheme="vnd.google.deeplink" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
是:
public class ParseDeepLinkActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate");
throw new RuntimeException("got here");
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用发布密钥库构建并在运行4.4的几个真实设备上进行测试. …
我需要安装一个没有安装我的应用程序的iOS用户,然后自动导航到我的应用程序中的一部分.
相关的是这个问题,但我并不完全依赖Google的SDK.我可以用任何东西.
我怎么能够
我在我的应用程序中使用应用程序索引,但有时它无法正确接收来自Chrome的意图.
如果我从我的生产网站打开链接,它将由chrome打开.所以我创建了一个具有相同代码的测试站点.但是,在这种情况下,我的应用正确打开深层链接.
我找不到任何解释,因为它在网络中使用相同的代码(但在不同的网站中)和相同的Android应用程序.
这是我的意图过滤器:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="soriabus-web.appspot.com" android:pathPrefix="/" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
这是我的按钮中的html代码:
<a href="https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados/true"
"type="button"
role="button"
class="btn btn-primary">
Abrir Soria Bus
</a>
Run Code Online (Sandbox Code Playgroud)
如果我打开此地址(制作)中的链接,则会打开Play商店(链接的末尾是重定向到Google Play):
https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados
如果我在这个其他地址(测试)中打开链接,它会打开我的app correclty:
https://central-splice-128620.appspot.com/parada/1/plaza-mariano-granados
我不明白为什么链接处理不同.谢谢.
编辑:
是因为我正在关注同一网站内的链接吗?
https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados => https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados/playstore
android deep-linking intentfilter android-app-indexing firebase-app-indexing
有太多深层链接(通用链接或应用链接)教程.但其中大多数都展示了如何在Android或IOS应用中启用它.此外还有付费云解决方案,但它们提供了许多功能.但是我在现实生活中面临三个主要问题:
我写了这个Q&A,这是我学习的结果(花了太多时间),以便有一个独特的,适用于所有案例的解决方案.
代码来自我的工作解决方案,但我删除了一些部分只是为了表明这个想法.如果存在一些编译问题,请按照算法编写自己的代码
这是解决方案,即使你知道一些步骤也要一步一步,因为代码中有技巧.还有一些解释在代码部分的注释行中,请阅读它们.
示例是使用最终的参数处理Android和IOS应用程序的深层链接http://example.com/v/,例如http://example.com/v/id-of-user?key=value.
1.配置Android
1.1将活动信息添加到AndroidManifest.xml文件中:
<activity
android:name=".appLinkHandlerActivity">
<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="example.com"
android:pathPrefix="/v/"
android:scheme="http" />
</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" />
<!—this intent is needed to handle links to myapp://share, I will explain later why we need it -->
<data
android:host="share"
android:scheme="myapp" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
1.2创建名为appLinkHandlerActivity的活动,该活动将处理单击的链接
public class appLinkHandlerActivity extends AppCompatActivity {
/* assume that user is clicked http://example.com/v/my-user-id
actCode will be …Run Code Online (Sandbox Code Playgroud) 我通过这种方式添加了一个到我的 Android 应用程序的深层链接:
<activity
android:name=".views.DeepLinkingActivity"
android:exported="true">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="example.com"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
当我点击https://example.com我被重定向到网站。
当我更改它时android:scheme="https",android:scheme="appscheme"它会工作并将我重定向到我的应用程序。
如何强制通过https方案打开我的应用程序?
更新
我添加了一个子域,但它仍然不起作用。
<activity
android:name=".views.DeepLinkActivity"
android:exported="true">
<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="https"
android:host="www.example.ru"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud) 我正在开发两个应用程序 A 和 B,我希望将它们与深层链接相互关联。
应用 B 有一个像下面这样的深层链接: myApp://open/myAction?param=123
看起来像:
<!-- Update myAction deep link -->
<intent-filter android:label="@string/launcherName">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE />
<data
android:host="open/*"
android:scheme="myApp" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
如果我使用 adb 启动应用程序,它就完美无缺。
现在,当用户单击 Activity A 中的按钮时,我正在尝试启动应用程序 B。
单击按钮时,我尝试了此操作(在:GoogleDeveloper 中找到)(OnClickListener)
// Build the intent
Uri myAction = Uri.parse(mEditText.getText().ToString()); // is something like: `myApp://open/myAction?param=1AD231XAs`
Intent mapIntent = new Intent(Intent.ACTION_VIEW, myAction);
// Verify it resolves
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(mapIntent, 0);
boolean isIntentSafe = …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置一个指向我的应用程序的通用链接,我的用户可以在 facebook 上共享该链接。我可以使它在电子邮件、短信、浏览器上工作,如下所示:
1- 如果用户没有应用程序,它会重定向到自定义 URL 或 AppStore 2- 如果用户有应用程序,它会打开应用程序,包括在自定义状态下打开应用程序的信息。当我尝试在 facebook 墙上或在 facebook messenger 中共享相同的链接时,它总是打开我设置的自定义 URL,即使我安装了该应用程序。
它适用于像whatsapp这样的应用程序。
我错过了什么?
我希望实现此功能,允许用户在手机或计算机上使用深层链接进入 Slack 频道,并在消息框中预先填写一些文本。
我翻阅了文档,没有找到相关的解决方案。
我希望找到一个如下所示的链接:
https://slack.com/app_redirect?app=A1BES823B?text=prefilled_message
Run Code Online (Sandbox Code Playgroud) 我正在构建一个 Android 应用程序,它允许用户在给定页面上打开网站上的页面。我为此使用 chrome 自定义选项卡。\n代码如下:
\n\nString url = \xc2\xa8https://website_containing_deep_link/\xc2\xa8;\nCustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();\nCustomTabsIntent customTabsIntent = builder.build();\ncustomTabsIntent.launchUrl(this, Uri.parse(url));\nRun Code Online (Sandbox Code Playgroud)\n\n在特定网站上,应该呈现的页面包含启动特定第三方应用程序的深层链接。
\n\n上面的代码启动网站,但也启动第 3 方应用程序。\n我可以配置自定义选项卡以不启动深层链接吗?
\n我正在尝试从 Android 中的 URL 进行应用程序链接,即单击相应链接时直接打开应用程序,而不显示意图选择器的建议(应用程序尚未在 Play 商店中发布)
尽管我的所有配置都是正确的...直接应用程序链接不起作用,只有我在建议中获取应用程序名称
我还尝试使用来自 google 的应用程序链接验证器。
它有一个奇怪的问题
在最初的尝试中,它显示为 No app deep linking permission found for app.glowify.glowify at admin.glowify.com.
单击“测试语句”按钮 2 或 3 次后,我收到“授予深度链接”
因此,我使用 JSON 比较工具将 URL 中的 json 与“生成语句”中的 json 以及链接https://admin.glowify.app/.well-known/assetlinks.json中上传的 json 进行了交叉检查 ,他们确认两者内容相同
但应用程序链接仍然没有直接打开应用程序。
所以我再次检查我的清单文件
这是:
<activity
android:name=".ui.entry.EntryActivity"
android:screenOrientation="portrait">
<intent-filter android:label="Glowify" android:autoVerify="true" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="admin.glowify.app"
android:pathPrefix="/password/verification"
android:scheme="http" />
<data
android:host="admin.glowify.app"
android:pathPrefix="/password/verification"
android:scheme="https" />
<data
android:host="admin.glowify.app"
android:pathPrefix="/room"
android:scheme="http" /> …Run Code Online (Sandbox Code Playgroud) deep-linking ×10
android ×7
app-store ×1
applinks ×1
deeplink ×1
facebook ×1
google-plus ×1
intentfilter ×1
ios ×1
kotlin ×1
messenger ×1
objective-c ×1
slack ×1
slack-api ×1