如何以编程方式生成指向 Firebase 中存储对象的动态链接? [英] How to programatically generate a Dynamic Link to a Storage Object in Firebase?

查看:30
本文介绍了如何以编程方式生成指向 Firebase 中存储对象的动态链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google IO 2016 中引入的新版 Firebase 引入了 Firebase 动态链接(作为深度链接概念的扩展)以及 Firebase 存储(由 Google Cloud Storage 提供支持).

The new version of Firebase introduced in Google IO 2016 has introduced Firebase Dynamic Links (as an extension of the deep linking concept) as well as Firebase Storage (powered by Google Cloud Storage).

如何以编程方式生成指向 Firebase 存储对象的 Firebase 动态链接?

How can programatically generate a Firebase Dynamic Link to a Firebase Storage Object?

EDIT-1

我了解到,我们可以使用以下代码获取包含 Storage 对象的 Google Cloud Storage 存储桶以及存储桶中对象的完整路径

I understand that we can get the Google Cloud Storage bucket that holds a Storage object and the full path to the object in the Storage bucket using the following code

public String getDynamicLink(StorageReference storageReference)
{
    String dynamicLink = "";

    String bucket = storageReference.getBucket();
    String path = storageReference.getPath();

    // How to generate dynamic link using the bucket and path?
    return dynamicLink;
}

Edit-2

根据 https://cloud.google.com/storage/docs/collaboration#浏览器,您可以使用以下语法构造一个指向 Google Cloud Storage 对象的 URL:

As per https://cloud.google.com/storage/docs/collaboration#browser, you can construct a URL to a Google Cloud Storage object using the following syntax:

https://storage.cloud.google.com/<bucket>/<object>

如何使用这个以编程方式生成动态链接?

How to programatically generate dynamic link using this?

推荐答案

终于搞定了

使用存储桶名称和存储对象路径生成问题中的编辑中提到的谷歌云存储对象 url.

Use the bucket name and storage object path to generate the google cloud storage object url as mentioned in the edits in the question.

然后以编程方式创建一个动态链接,方法是使用以下形式构造一个 URL:

Then create a Dynamic Link programmatically by constructing a URL with the following form:

https://domain/?link=your_deep_link&apn=package_name[&amv=minimum_version][&ad=1][&al=android_link][&afl=fallback_link]

请看https://firebase.google.com/docs/dynamic-links/android#create-a-dynamic-link-programmatically了解更多详情.

这篇关于如何以编程方式生成指向 Firebase 中存储对象的动态链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆