我有一个非常分层的应用程序(活动类似于League> Team> Position> Player)所以我已经完成了每个活动singleTop,以保持导航合理并防止重复实例.
现在我正在制作我的第二个应用程序,我已经看到它建议声明我的应用程序是singleTask为了防止重复的实例.有人可以帮助解释每种方法的优点吗?
我的新应用程序只是一个包含3个片段的活动,然后我可能会添加一个设置活动,也许还有一个FAQ.
编辑:我刚刚意识到这singleTask并没有像我想象的那样阻止我的应用程序的重复实例.现在正在寻找处理这个问题的正确方法......
android android-manifest android-activity android-navigation
它AndroidManifest.xml包含应用程序的版本名称,例如
android:versionName="1.0"
Run Code Online (Sandbox Code Playgroud)
现在的问题是 - 在某种程度上可以在源代码中访问此版本名称,以便我可以在例如About中显示它Dialog吗?
我按照https://developer.android.com/training/app-indexing/deep-linking.html上的说明进行操作,但是当我想触发意图adb时:
adb shell am start
-W -a android.intent.action.BROWSEABLE
-d "http://example.com/gizmos" com.myapp.android
Run Code Online (Sandbox Code Playgroud)
我得到了
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=example://gizmos flg=0x10000000 pkg=com.myapp.android }
<activity
android:name=".activities.DeepLinkActivity"
android:label="@string/title_activity_deep_link">
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<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="http"
android:host="example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
我有任何明显的错误吗?
我在android提供的Log.java上编写了一个包装器.我的类将在日志中添加一些其他应用程序级功能.
现在问题是我想从代码中检查androidManifest.xml文件中的"debuggable"是否设置为"true"或"false".
我能这样做吗?如果有,怎么样?
我正在开发一个需要使用谷歌地图的android项目.我一直在阅读教程,我必须将其添加到AndroidManifest.xml文件中:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Run Code Online (Sandbox Code Playgroud)
问题是,我不知道用"@ integer/google_play_services_version"代替什么号码.
如果有人知道我应该进入那里,以及如何获得整数值,我会很感激.
我是android新手,我之前没有看到或听说过元数据.然而,我谷歌并在YouTube上搜索它,它基本上是你的对象的信息.如果我错了,请纠正我.任何人都可以帮助我以更好的方式理解它.
1)什么是元数据?
2)为什么在Android中使用它?
如果解释为什么在Android中使用元数据的示例将会很好.我在manifest的活动元数据标签中看到过它们.
我已添加android:exported="true"到清单中唯一的活动,但在将编译 sdk 和目标 sdk 版本更新为 31 后仍然出现以下错误。我还尝试重建项目、使缓存无效并重新启动,但这没有帮助
错误- Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xyz.abc">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".framework.presentation.BaseApplication"
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">
<activity android:name="com.xyz.presentation.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
play-services-auth-api-phone:17.4.0 清单、leakcanary-android:2.0-alpha-3 清单、firebase-auth-interop:20.0.0 清单、生命周期-viewmodel:2.3.1 清单、浏览器:1.0。 0 …
android manifest android-manifest targetsdkversion android-12
我有一个有两个活动的应用程序,我希望能够在启动器中显示两个图标,每个图标在应用程序中启动相应的活动.
具体来说,我想要一个图标来启动我的主应用程序,另一个图标来启动我的设置活动.这可能吗?
这是我到目前为止所尝试的:
<activity android:label="MyApp" android:name=".MyApp">
<intent-filter>
<action android:name=".MyApp"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:label="Settings" android:name=".Settings">
<intent-filter>
<action android:name=".Settings"/>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
这会创建两个启动器图标,但它们都运行我的主应用程序而不是运行我的设置应用程序的第二个图标.我尝试过只有启动器类别,但后来我没有得到一个图标,所以看起来我也需要主要动作.
这是正确的方法还是应该在清单中声明两个应用程序?
我想将我的应用程序设置为全屏视图.我有想法使用FullScreen和在单个活动中设置它NoTitlebar,但是我想在整个应用程序的Manifest XML文件中设置它而不是每个活动......这可能吗?
帮帮我......谢谢.
在Android的源是一个Git仓库的大型层次结构.它们由名为repo的自定义脚本管理.Repo使用manifest.xml确定要管理的git存储库.Android的manifest.xml与所有其他git存储库一起托管在git存储库中.
如何在Android中管理此存储库?具体来说,每个分支中托管的不同分支和不同文件是如何组织的?
android ×10
android-manifest ×10
android-12 ×1
deep-linking ×1
git ×1
google-maps ×1
manifest ×1
metadata ×1
repository ×1