activity-manager 相关问题


如何使用父 Activity 或其他 Activity 的 Fragment 中的值?

我试图将 Fragment 中的价值传递给其父 Activity (通过父活动是指片段的父活动:片段在父活动中) 我知道我可以使用 ShareViewModel,但我想知道...


通过 github 操作创建 EC2 AMI 时出现错误:exec: "session-manager-plugin": $PATH 中找不到可执行文件

==> learn-packer.amazon-ebs.ubuntu:exec:“session-manager-plugin”:在 $PATH 中找不到可执行文件 learn-packer.amazon-ebs.ubuntu:启动 portForwarding 会话“Amy-


SecurityException:不允许启动服务Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (有额外功能)}

我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: 字符串SENDER_ID =“722*****53”; /** * 向 GCM 服务器异步注册应用程序。 * * 存储注册信息... 我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: String SENDER_ID = "722******53"; /** * Registers the application with GCM servers asynchronously. * <p> * Stores the registration ID and the app versionCode in the application's * shared preferences. */ private void registerInBackground() { new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... params) { String msg = ""; try { if (gcm == null) { gcm = GoogleCloudMessaging.getInstance(context); } regid = gcm.register(SENDER_ID); msg = "Device registered, registration ID=" + regid; // You should send the registration ID to your server over // HTTP, so it // can use GCM/HTTP or CCS to send messages to your app. sendRegistrationIdToBackend(); // For this demo: we don't need to send it because the // device will send // upstream messages to a server that echo back the message // using the // 'from' address in the message. // Persist the regID - no need to register again. storeRegistrationId(context, regid); } catch (IOException ex) { msg = "Error :" + ex.getMessage(); // If there is an error, don't just keep trying to register. // Require the user to click a button again, or perform // exponential back-off. } return msg; } @Override protected void onPostExecute(String msg) { mDisplay.append(msg + "\n"); } }.execute(null, null, null); } 我收到错误: 03-01 19:15:36.261: E/AndroidRuntime(3467): FATAL EXCEPTION: AsyncTask #1 03-01 19:15:36.261: E/AndroidRuntime(3467): java.lang.RuntimeException: An error occured while executing doInBackground() 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$3.done(AsyncTask.java:299) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.lang.Thread.run(Thread.java:841) 03-01 19:15:36.261: E/AndroidRuntime(3467): Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startServiceAsUser(ContextImpl.java:1800) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startService(ContextImpl.java:1772) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.content.ContextWrapper.startService(ContextWrapper.java:480) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.b(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:177) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:1) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 03-01 19:15:36.261: E/AndroidRuntime(3467): ... 4 more 这是我的清单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.manyexampleapp" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" /> <permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <application android:name="com.zoomer.ifs.BaseApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.zoomer.ifs.MainActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTop"> <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <!-- PUSH --> <!-- WakefulBroadcastReceiver that will receive intents from GCM services and hand them to the custom IntentService. The com.google.android.c2dm.permission.SEND permission is necessary so only GCM services can send data messages for the app. --> <receiver android:name="com.example.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <!-- Receives the actual messages. --> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.example.manyexampleapp" /> </intent-filter> </receiver> <service android:name="com.example.gcm.GcmIntentService" /> <activity android:name="com.example.gcm.DemoActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- DB --> <activity android:name="com.example.db.DbActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.http.RestGetActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > </activity> <activity android:name="com.example.fb.FacebookLoginActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SendFeedbackActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.zoomer.general.SearchNearbyOffersActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.manyexampleapp.StoresListActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb.ShareActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.notifications.NotificationsActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb2.no_use.MainActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.zoomer.offers.OffersListActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SearchNearbyOffersActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <service android:name="com.example.geo.LocationService" android:enabled="true" /> <receiver android:name="com.example.manyexampleapp.BootReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="com.example.manyexampleapp.LocationService.LOCATION_BROAD_MSG" /> </intent-filter> </receiver> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" /> </application> </manifest> 改变 <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> 到 <!-- This app has permission to register and receive data message. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 您收到异常是因为您尚未定义所需的权限 如果应用程序开发后安装了播放服务, 可能会发生 com.google.android.c2dm.permission.RECEIVE 权限已被授予但 android 仍在抱怨同样的错误。 在这种情况下,您必须完全重新安装开发的应用程序才能使此权限发挥作用。 我认为你必须检查 Kotlin 版本兼容性。


使用 YubiKey Manager 和 .crt 证书(不使用 .PFX)签署 MSI 文件时出现问题

我一直在尝试使用 YubiKey Manager 和 .crt 证书(由于最近的 CAB 和 Sectigo 规则而不是 PFX)来签署我的 MSI 文件,但找不到让它工作的好方法。 我已经关注了这些


SharePoint 修补问题

我们在装有 SharePoint Server 2019 的 Microsoft Identity Manager (MIM) Web 服务器上应用了 12 月份的 SharePoint 补丁(KB5002531 和 KB5002532)。修补后,我们看到以下错误“The con...”


SSAS/Power BI 行级安全性

我一直在使用 radacad 创建的一些非常有用的文章(例如 https://radacad.com/dynamic-row-level-security-with-manager-level-access-in-power-bi),使我能够添加一些行级安全...


GA4 配置发送浏览器标题而不是 CustomVirtualPageTitle

我已按照本指南中提到的步骤进行操作:https://www.analyticsmania.com/post/single-page-web-app-with-google-tag-manager/ 每当用户导航时 dataLayer.push 代码页面/st之间...


Flutter 模拟器 > Android studio SDK Manager > 命令行工具安装问题

我刚刚开始学习Flutter。 在我的 Mac 上安装 Android studio 时出现错误 😭 (实际上,安装已完成,应用程序看起来不错。但 flutter doctor 返回问题) 我的环境...


自 Android 13 起无法启动任意 Activity

我构建了一个小型个人应用程序,它允许我为不同的 URL 指定不同的浏览器。在 Android 13 之前,它运行良好,但在 Android 13 之后的某个时候,它开始失败......


本地运行测试时如何禁用 Spring Cloud Google Secret Manager 4.x+?

我们使用的是 spring boot 3.2,我们正在尝试将 spring-cloud-gcp-starter-secretmanager 从版本 3.2.1 升级到 4.9.0。当我们这样做时,我们的集成测试会失败,并显示: java.lang.


从 Android Automotive OS 中“Screen”子类的方法获取“Activity”实例

我正在尝试在 Android (13) 汽车操作系统中制作一个简单的应用程序。我的理解非常有限,尤其是在活动方面。在onGetTemplate中,我希望请求许可,w...


无需公钥、私钥和公共 Ips 即可通过 SSH 连接到 Aws Ec2 实例

在我的公司,一位同事创建了没有公共 IP 地址的 Ec2 实例。我没有公钥和私钥。我可以与 SSM Manager 或 EC2 Instance Connect Endpoint 建立连接,但我...


如何在 Kotlin 的主 Activity 中启用/禁用片段按钮

与此类似的问题有几个答案,但在 Kotlin 中没有。 我有一个带有一个按钮和两个片段的主要活动。在第一个片段中有一个导航按钮,可以启动...


如何获取 Activity 以便将其传递给 androidStudio 中的函数?

我按照 youtube 上的教程来获取位置。它运行良好,但我尝试将其更改为一个函数,以便我可以在使用 navcontroller 的应用程序中使用它,现在它要求一个活动...


MVVM:ViewModel逻辑需要来自数据库的信息,但是如何等待数据?

我是 MVVM 新手,正在尝试弄清楚如何组织我的应用程序。我制作了一个简化的登录应用程序来帮助解决问题。 我将应用程序分为几层:Activity -> ViewModel -> Reposit...


如何保存Activity的状态?应用程序关闭时所有信息都会丢失

我需要我的应用程序保存图像和未来文本字段的状态,以便当用户关闭应用程序甚至重新启动手机时,数据仍然存在。这有点像日记。 班级舞台...


活动深层链接 - IllegalArgumentException:缺少必需的参数并且没有 android:defaultValue

在我的应用程序中,我有以下结构: 在我的应用程序中,我具有以下结构: <!-- AndroidManifest.xml --> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application> <activity android:name=".DeepLinkActivity" android:exported="true" android:launchMode="singleInstancePerTask"> <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="myhost" android:path="/mypath" android:scheme="myscheme" /> </intent-filter> </activity> </application> </manifest> <!-- activity_deep_link.xml --> <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.fragment.app.FragmentContainerView android:id="@+id/navHostFragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" tools:navGraph="@navigation/my_nav_graph" /> </FrameLayout> // DeepLinkActivity.kt class DeepLinkActivity : AppCompatActivity() { private lateinit var binding: ActivityDeepLinkBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityDeepLinkBinding.inflate(layoutInflater) setContentView(binding.root) setUpNavigationGraph() } private fun setUpNavigationGraph() { val navHostFragment = supportFragmentManager .findFragmentById(binding.navHostFragment.id) as NavHostFragment val navController = navHostFragment.navController val navGraph = navController.navInflater .inflate(R.navigation.my_nav_graph) .apply { this.setStartDestination(R.id.notTheStartDestinationFragment) } val startDestinationArgs = bundleOf( "someRequiredArgumentHere" to false ) navController.setGraph(navGraph, startDestinationArgs) } } 当我通过 ADB (adb shell am start -d myscheme://myhost/mypath) 通过深度链接打开该活动时,该活动正常启动。 但是当我通过 Chrome 应用程序启动它时,应用程序崩溃了: 原因:java.lang.IllegalArgumentException:缺少必需参数“someRequiredArgumentHere”并且没有 android:defaultValue 观察:我正在使用 Safe Args 插件。 我做错了什么以及为什么行为不同? 我刚刚发现为什么在通过浏览器导航时会忽略 startDestinationArgs。 如果我们检查NavController#setGraph(NavGraph, Bundle?)的内部代码,如果没有发生深层链接,NavController#onGraphCreated(Bundle?)只会使用startDestinationArgs。 作为一种解决方法,在设置导航图之前,我只需清除活动的意图(但这可能不是解决该问题的最佳方法)


SQLServer 存在哪些会话提供程序类型?

如果您想在 web.config 中实现 SQL 会话,通常会有一些简单的内容,例如: 如果您想在 web.config 中实现 SQL 会话,通常会有一些简单的内容,例如: <sessionState mode="SQLServer" sqlConnectionString="myConnectionString"/> 但是,如果您想要一个自定义提供程序来执行诸如使用配置生成器隐藏连接字符串之类的操作,您可以编写以下内容: <sessionState mode="Custom" customProvider="SQLSessionProvider"> <providers> <add name="SQLSessionProvider" connectionStringName="SQLSessionService" type=""/> </providers> </sessionState> <connectionStrings configBuilders="CS_Environment"> <add name="SQLSessionService" connectionString="Environment_Key_Here" /> </connectionStrings> 问题是我不知道mode=SQLServer存在什么类型。在我的搜索中,我看到了 OBDC 会话的示例,其中 type=ObdcSessionStateStore 以及各种其他会话提供程序,但没有一个适用于 SQLServer。 SQLServer 存在哪些会话提供程序类型? 您可以使用此功能并通过 Nuget Package Manager 安装的 type 是 Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 还应该安装SessionState.SessionStateModule。如果您是第一次将其安装到项目中,它将在您的 <sessionState> 中为您创建一个 web.config 模板。下面是如何使用它的示例: <connectionStrings configBuilders="CS_Environment"> <add name="SQLSession_Connection" providerName="System.Data.SqlClient" connectionString="SQLSessionProvider-configBuilder_failed" /> </connectionStrings> <sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" customProvider="SqlSessionStateProviderAsync"> <providers> <add name="SqlSessionStateProviderAsync" connectionStringName="SQLSession_Connection" type="Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </providers> </sessionState> @8protons,您以前有使用过 Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync 的经验吗?我收到“在应用程序配置中找不到或连接字符串为空”错误 lmk 如果您能提供帮助


© www.soinside.com 2019 - 2024. All rights reserved.