Serializable使用深层链接时是否可以使用自定义对象作为片段参数?
我已经尝试了以下操作 - 在我的导航图 XML 文件中,我添加了以下几行:
<fragment
android:id="@+id/eventFragment"
android:name="com.myapp.EventFragment"
android:label="EventFragment">
<argument
android:name="event"
app:argType="com.myapp.EventId" />
<deepLink app:uri="myapp://event/{event}" />
</fragment>
Run Code Online (Sandbox Code Playgroud)
EventId可序列化数据类在哪里:
data class EventId(val value: Long) : Serializable
Run Code Online (Sandbox Code Playgroud)
然后,当我尝试使用 URL 运行应用程序时myapp://event/4002,会引发以下异常:
Caused by: java.lang.UnsupportedOperationException: Serializables don't support default values.
at androidx.navigation.NavType$SerializableType.parseValue(NavType.java:834)
at androidx.navigation.NavType$SerializableType.parseValue(NavType.java:787)
at androidx.navigation.NavType.parseAndPut(NavType.java:96)
at androidx.navigation.NavDeepLink.getMatchingArguments(NavDeepLink.java:99)
at androidx.navigation.NavDestination.matchDeepLink(NavDestination.java:366)
at androidx.navigation.NavGraph.matchDeepLink(NavGraph.java:79)
at androidx.navigation.NavController.handleDeepLink(NavController.java:540)
at androidx.navigation.NavController.onGraphCreated(NavController.java:499)
at androidx.navigation.NavController.setGraph(NavController.java:460)
at androidx.navigation.NavController.setGraph(NavController.java:425)
at androidx.navigation.NavController.setGraph(NavController.java:407)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.java:236)
Run Code Online (Sandbox Code Playgroud)
long用( )替换 typeapp:argType="long"解决了问题 - 没有例外,一切都按预期进行。
导航库似乎不知道如何将 URL 中的原始值转换为我的EventId类。是否可以以某种方式注册一个知道如何转换它的适配器?或者也许还有另一种解决方案?
android android-navigation android-architecture-navigation android-deep-link android-jetpack-navigation
我们有一个移动应用程序和一个网站。用户会收到包含网站页面链接的电子邮件。我们使用 iOS 通用链接和 Android 应用程序链接将移动应用程序与网站关联起来。
假设电子邮件中的链接是https://abc/ticket/1234。当用户点击链接时,它会在移动应用程序中打开相关页面。用户可以通过点击移动页面中的按钮来打开网站中的相同内容。它会打开网站中的相关页面。我们不直接打开URL https://abc/ticket/1234。这是因为用户首先通过 IDP 进行身份验证,然后重定向到正确的页面。URL 类似于https://abc.idp?token=xyz&redirect=https://abc/ticket/1234。
这就是问题所在。
简而言之,
我们需要告诉操作系统是否从同一链接打开应用程序或浏览器。
我们考虑使用 URL https://abc/ticket/1234?do_not_open_mobile_app=true传递附加参数,但无法在 apple-app-site-association 文件中使用查询参数进行 URL 比较。然后我们尝试为 IDP 启用深度链接,然后它在 Android 中运行良好,但在 iOS 中却不行。
非常感谢您的投入。
android objective-c ios ios-universal-links android-deep-link
我需要从我的本机移动应用程序中打开第三方应用程序。我知道这在 iOS 上称为通用链接,在 Android 上称为 AppLink。
我为此做了很多研究,并且我已经能够在应用商店中设置到第三方应用的链接。现在我只需要让我的应用程序打开应用程序,如果用户安装了它。不过,这需要其他应用程序的 URI 方案。
我的问题是,如何获取此第三方应用程序的 URI 方案?相反,我如何获取任何应用程序的 URI 方案?我知道 twitter 应用程序的 URI 方案是“twitter://app”,但我试图链接到的应用程序比 twitter 或其他流行应用程序更小众,因此在线这类事情没有帮助。
有小费吗?
mobile jsx react-native ios-universal-links android-deep-link
我正在使用 Jetpack Navigation 进行深层链接。我已添加android:launchMode="singleTask"到我的活动中。如果之前未打开该应用程序,Deeplink 将正确重定向。但是,如果该应用程序存在于内存中,则该应用程序将进入前台,但无法正确打开深层链接。
我的设备是带有 Android 10 的 Pixel 2。我看到onCreate只有在我第一次打开应用程序时才会调用它。但是,onNewIntent每次单击深层链接时都会调用。
是 Jetpack Navigation 中的错误还是我在设置时忘记了某些内容?
我们为深层链接intent-filters定义了一些AndroidManifest。我们还有assetlinks.json文件放置在我们域中的适当位置,并带有正确的 SHA 指纹。我们面临一个奇怪的问题,当从 Android Studio 安装应用程序时,这些应用程序链接直接打开我们的应用程序,中间没有任何选择器。
这也是我们想要的行为,但是,当我们将我们的应用程序上传到 Google Play 并从那里下载时,这些应用程序链接App chooser首先打开,这不是我们想要的行为。
我们做了一些实验,比如为两个不同的链接创建不同的意图过滤器,删除一个链接等,但这种行为保持不变。还仔细检查了 SHA 指纹,它们似乎没问题。
在我的应用程序中,我想使用deeplink。当添加intent-filter了深层链接的启动activity,不见了应用程序图标到应用程序抽屉里!
但是当删除深层链接 时,将intent-filter应用程序图标显示到应用程序抽屉中。
清单代码:
<activity android:name=".Pages.Splash.SplashPage">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- DeepLink -->
<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.example.com"
android:pathPrefix="/gaming"
android:scheme="http" />
<data
android:host="example.com"
android:pathPrefix="/gaming"
android:scheme="http" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
使用以上代码时,不在应用程序抽屉中显示应用程序图标,而是从manifest显示图标中删除以下代码时。
<!-- DeepLink -->
<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.example.com"
android:pathPrefix="/gaming"
android:scheme="http" />
<data
android:host="example.com"
android:pathPrefix="/gaming" …Run Code Online (Sandbox Code Playgroud) assetlinks.json如果我使用 firebase 为动态链接提供的域,如何修改?它是可以访问的,目前它返回空数组:
firebase firebase-dynamic-links android-deep-link android-app-links
我有一个相当简单的问题,但我似乎找不到解决方案。我有一个包含多个活动的 Android 应用程序。我想形成特定活动的特定深层链接,并将所有其他深层链接定向到“包罗万象”类型的活动。
这是我的清单:
<activity
android:name=".views.activity1">
<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="domain"
android:host="specificPlace" />
</intent-filter>
</activity>
<activity
android:name=".views.activity2">
<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="domain"
android:host="*" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
所以我想要的是以下内容:
domain://specificPlace-> 到 Activity1 的深层链接。
domain://-> 深层链接到activity2
domain://random-> 深层链接到activity2
domain://somewhereElse-> 深层链接到activity2
现在,domain:// 任何内容都解析为 Activity2。
感谢任何帮助,提前致谢!
我在 Android Studio (2022.3.1) 中创建了一个应用程序,它只包含一个 webview 并处理 url。它一直有效,直到我通过意图添加深层链接。有人可以告诉我,这有什么问题吗?
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.FullscreenDark"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.FullscreenDark">
<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="@string/app_host" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
MainActivity.kt:
package com.app.myapp
import android.annotation.SuppressLint
import android.os.Bundle
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
private lateinit var webView: …Run Code Online (Sandbox Code Playgroud) android ×7
deep-linking ×2
android-architecture-navigation ×1
firebase ×1
ios ×1
java ×1
jsx ×1
kotlin ×1
mobile ×1
objective-c ×1
react-native ×1
webview ×1