我有一个 Android 应用程序,其应用程序链接在运行 Android OS 11 的设备上按预期工作,但由于这些targetSdkVersion : 30更改,它们在运行 Android OS 12 的另一台设备上被破坏(默认情况下 Web 链接不会打开应用程序)。我应该转到操作系统级别设置并手动添加(请参阅我的应用程序屏幕截图)链接以使它们打开应用程序。
有一些应用程序,例如 gmail,默认情况下已验证链接(请参阅 gmail 屏幕截图),我也试图通过遵循此处的Android 文档来为我的应用程序实现相同的目标。但是,当我尝试查看验证结果时,我没有看到预期的输出(请参阅终端屏幕截图)。我等了几分钟才查看验证结果,但还没有任何结果。可能我错过了一些东西,我需要一些帮助。谢谢。
我有以下清单代码:
<activity
android:name=".InterceptorActivity"
android:launchMode="singleTask"
android:parentActivityName=".HomeActivity"
tools:ignore="UnusedAttribute"
android:theme="@style/Theme.Startup"
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"/>
<data android:scheme="http"/>
<data android:host="www.mysite.com"/>
<data android:pathPrefix="/myPage"/>
<data android:pathPrefix="/myFavourites"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
assetlinks.json 看起来没问题并且上传正确。但所有应用程序链接仍然仅在浏览器中打开,我看到该应用程序支持该链接,但未选中。
另外命令“adb shell pm get-app-links”com.myapp.android”返回
com.myapp.android:
ID: 893......
Signatures: [13:03....DA]
Domain verification state:
www.myapp.com: legacy_failure
Run Code Online (Sandbox Code Playgroud)
为什么?请帮忙。
拥有拦截推送通知的android sdk,并一直使用通知蹦床来进一步打开结束活动。对于深度链接,使用此 sdk 的应用程序将打开配置的深度链接处理程序活动。
片段trampoline:
public class NotificationTrampolineReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, final Intent intent) {
final PendingResult asyncResult = goAsync();
ExecutorService executor = Executors.newSingleThreadExecutor();
asycTask(executor, new Runnable() {
@Override
public void run() {
String urlStr = getStringExtra(intent, PUSH_URL);
if (urlStr != null) {
var intent2: Intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlStr));
if (intent2 != null) {
intent2.addFlags(FLAG_ACTIVITY_NEW_TASK);
intent2.addFlags(FLAG_ACTIVITY_BROUGHT_TO_FRONT);
context.startActivity(intent2);
logAnalytics(intent, Message.MessageAction.OPEN);
}
}
asyncResult.finish();
}
});
}
void asycTask(ExecutorService executor, final Runnable task) { …Run Code Online (Sandbox Code Playgroud) 大家好,我的全屏有问题,我尝试了各种设置,但无法在 android 12 api31 上获得全屏。
目前我已经这样设置了。
我像这样运行应用程序
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []).then(
(_) => runApp(MyApp()),
);
Run Code Online (Sandbox Code Playgroud)
在 styles.xml 中
<style name="NormalTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
// Important to draw behind cutouts
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在AndroidManifest.xml中
android:windowSoftInputMode="adjustResize"
Run Code Online (Sandbox Code Playgroud)
我也尝试过其他的事情,但目前我得到的最好的结果是这个
return Scaffold(
body: Container(
color: Colors.deepPurple,
child: const Center(
child: Text(
"Container full",
style: TextStyle(fontSize: 40),
),
),
),
);
Run Code Online (Sandbox Code Playgroud)
我想覆盖整个屏幕,但我什至无法覆盖缺口
最终结果应该是这样的。我希望能够操纵我的应用程序的整个屏幕空间。我不想要系统栏。
我正在构建一个带有信标集成的 SDK API,它需要 Android 12 及更高版本的蓝牙扫描权限。因此,我为 API 添加了注释,如下所示:
@RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_SCAN])
fun enableBeaconScan()
Run Code Online (Sandbox Code Playgroud)
当我添加此内容时,我收到警告:
有没有办法限制此权限仅适用于支持的 Android 版本并消除此警告?
这个问题实际上有两个部分
从 Android 12 开始,深层链接发生了很大变化。
我的第一个问题是这两个都需要实现才能使深层链接发挥作用吗?
其次,在阅读文件时,我发现了这个特殊的注释,其中包含以下内容
不要在清单文件中发布带有公众无法访问的开发/测试 URL 的应用程序(例如只能通过 VPN 访问的任何 URL)。这种情况下的解决方法是配置构建变体,为开发构建生成不同的清单文件。
这是否意味着访问受限的暂存环境不能用于测试?
笔记:
<activity
android:name=".view.activity.MemberProfileActivity"
android:screenOrientation="portrait"
android:noHistory="true"
android:windowSoftInputMode="adjustResize|stateHidden">
<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="http" />
<data android:scheme="https" />
<data
android:host="@string/base_domain"
android:pathPrefix="/member_profile/" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
任何帮助是极大的赞赏。
android android-manifest android-deep-link android-app-links android-12
嘿伙计们
我已将 MyApp 更新为针对 Android 12,并使用新的 SCHEDULE_EXACT_ALARM 权限遇到了一些奇怪的行为。
我对新引入的权限有以下问题
在我的AndroidManifest.xml中,我声明了如下权限:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myfirm.myapp">
.... more permissions
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<application>
....
</application>
<service
android:name="com.myfirm..services.KernelStartedService"
android:enabled="true"
android:exported="true"
android:process=":KernelStartedService">
<intent-filter>
<action android:name="com.myfirm.service.kernel.api.ANDROID_KERNEL_SERVICE_BINDING_ACTION" />
</intent-filter>
</service>
</manifest>
Run Code Online (Sandbox Code Playgroud)
正如您在声明中看到的,进程属性的值以冒号 (:) 开头,
这意味着应用程序私有的新进程会在需要时创建,并且服务在该进程中运行。
在启动或绑定此服务之前,如果使用此辅助函数授予了权限,我会调用一个测试:
private fun canExactAlarmsBeScheduled(): Boolean {
val alarmManager = this.getSystemService(ALARM_SERVICE) as AlarmManager
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
alarmManager.canScheduleExactAlarms()
} else {
true // below API it can always be scheduled
}
}
Run Code Online (Sandbox Code Playgroud)
然后,在第一个 Activity 的 onStart 方法中,我会测试是否授予了权限,如果没有,我会向用户显示一个对话框,表明他需要向我的应用程序授予此权限:
override fun …Run Code Online (Sandbox Code Playgroud) 我正在使用 Android 的新启动屏幕 API,我发现这个新 API 存在限制。我想将徽标放置在中心线上方,而不影响初始屏幕中徽标的大小(这是我的应用程序用户体验的要求)。我的标志也是方形的。
有没有办法在新的 API 中做到这一点,或者我必须走旧的路。会不会有什么问题,因为新的 API 文档说
如果您之前在 Android 11 或更低版本中实现了自定义启动画面,则需要将应用迁移到 SplashScreen API,以确保其在 Android 12 及更高版本中正确显示。有关说明,请参阅将现有的初始屏幕实现迁移到 Android 12。
android splash-screen android-layout android-drawable android-12
更新后,Java 11通过命令在 Android Studio 中出现错误./gradlew lintFooDebug。
* What went wrong:\n\nExecution failed for task \xe2\x80\x98foo:syncDebugLibJars'.\n> NestMember requires ASM7\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x80\xa2 然./gradlew dependencyReport。修复了所有asm版本7。
\xe2\x80\xa2 在文件内搜索 asm 文本 - 没有发现任何可疑的内容。
\n\xe2\x80\xa2 添加implementation "org.ow2.asm:asm:7.0"到所有build.gradle文件。万一。
\xe2\x80\xa2./gradlew lintFooDebug --scan使用scan标志运行以获取详细信息:
Caused by: java.lang.UnsupportedOperationException: NestMember requires ASM7 \nat org.objectweb.asm.ClassVisitor.visitNestMember(ClassVisitor.java:251) \n at org.objectweb.asm.ClassReader.accept(ClassReader.java:663) \n at org.objectweb.asm.ClassReader.accept(ClassReader.java:394) \n at com.android.builder.packaging.TypedefRemover.rewriteOuterClass(TypedefRemover.java:239) \n at com.android.builder.packaging.TypedefRemover.filter(TypedefRemover.java:139) \n at com.android.builder.packaging.JarFlinger.addDirectory(JarFlinger.java:107) \n …Run Code Online (Sandbox Code Playgroud) android-12 ×10
android ×9
alarmmanager ×1
applinks ×1
dart ×1
flutter ×1
gradle ×1
gradlew ×1
intentfilter ×1
java-11 ×1
process ×1