我有一个 android 应用程序,它应该在类似
的链接上方打开自己https://example.com/copyPOI/?ID=613a558o3f8ba
我的 Android 清单是:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="false">
<activity android:name=".Help" />
<activity android:name=".Orte" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<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:scheme="https"
android:host="example.com"
android:pathPrefix="/copyPOI/" />
<data
android:scheme="https"
android:host="www.example.com"
android:pathPrefix="/copyPOI/" />
<data
android:scheme="http"
android:host="example.com"
android:pathPrefix="/copyPOI/" />
<data
android:scheme="http"
android:host="www.example.com"
android:pathPrefix="/copyPOI/" />
</intent-filter>
</activity>
</application>
我的主要活动是:
// Get the intent that started this activity
// Falls die App über einen Link aufgerufen wurde, wird dieser hier verarbeitet
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) { // bei null wurde die App ganz normal über den Launcher aufgerufen
// Log-Ausgabe für Debugging-Zwecke hinzufügen
Log.d("MainActivity", "App opened with link. URI: " + data);
// Eintrag des zu kopierenden Links in die db
copyLink(data);
} else {
// Log-Ausgabe für Debugging-Zwecke hinzufügen
Log.d("MainActivity", "App opened without link.");
make_refresh();
}
但是我的浏览器没有打开我的应用程序,而是获取该链接并想要打开它。
有人看到这里出了什么问题吗? 我用的是安卓14。
预先感谢您的帮助。