【发布时间】:2022-01-25 19:23:41
【问题描述】:
我在 androidmanifest.xml 中配置了一个活动:
<activity android:name="com.google.androidbrowserhelper.trusted.LauncherActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="@string/app_name">
<meta-data
android:name="android.support.customtabs.trusted.DEFAULT_URL"
android:value="https://www.xxxx.com/app" />
<meta-data android:name="android.support.customtabs.trusted.SPLASH_IMAGE_DRAWABLE" android:resource="@drawable/icon"/>
<meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_BACKGROUND_COLOR" android:resource="@color/splash"/>
<meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_FADE_OUT_DURATION" android:value="3000"/>
<meta-data android:name="android.support.customtabs.trusted.FILE_PROVIDER_AUTHORITY" android:value="${applicationId}.fileprovider"/>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.support.customtabs.action.CustomTabsService" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="xxxx.com" android:pathPrefix="/app" />
</intent-filter>
</activity>
当 this 在意图过滤器中运行时
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
它可以很好地显示启动画面,但是当我通过单击主活动中的按钮调用它时:
Intent intent = new Intent(this, typeof(Com.Google.Androidbrowserhelper.Trusted.LauncherActivity));
intent.SetData(Android.Net.Uri.Parse("https://www.xxxx.com/app/"));
StartActivity(intent);
它忽略所有元数据设置并闪烁白屏。
我已经尝试添加
<action android:name="com.mycompany.product.VIEW" />
对此并尝试通过调用来运行它:
Intent intent = new Intent("com.mycompany.product.VIEW", Android.Net.Uri.Parse("https://www.xxxx.com/app/"));
StartActivity(intent);
但这只是给我:
No Activity found to handle Intent
【问题讨论】:
标签: android xamarin android-intent android-manifest trusted-web-activity