简体   繁体   English

如何在可通过 App Wrapping 配置的 Xamarin Android App 中创建设置

[英]How to create a setting in an Xamarin Android App that is configurable via App Wrapping

I have created a Xamarin Android App that has a single setting that the user is prompted to enter on first start-up.我创建了一个 Xamarin Android 应用程序,该应用程序有一个设置,提示用户在首次启动时输入。 The setting is then saved using Xamarin.Essentials.Preferences.Set and retrieved from then on using Xamarin.Essentials.Preferences.Get .然后使用 Xamarin.Essentials.Preferences.Set 保存设置,然后使用Xamarin.Essentials.Preferences.Set检索Xamarin.Essentials.Preferences.Get

I need to make this setting configurable via "App Wrapping".我需要通过“App Wrapping”来配置这个设置。 I have search high and low to work out how to do this, and I am not able to find an example.我已经搜索了高低以找出如何做到这一点,但我找不到一个例子。

I did want to create the setting in a way where it showed in the Android Settings app (Android Settings/Apps/App Setting for the app), thinking if the setting was accessible in there it would be configurable by App Wrapping, but was not able to find a way of doing this either.我确实想以 Android 设置应用程序(应用程序的 Android 设置/应用程序/应用程序设置)中显示的方式创建设置,考虑是否可以在其中访问设置,它可以通过应用程序包装进行配置,但不是能够找到一种方法来做到这一点。

My app doesn't have a settings UI and doesn't need one, I just need a way to make this one setting configurable via App Wrapping.我的应用没有设置 UI,也不需要,我只需要一种方法来通过 App Wrapping 使这个设置可配置。

Can anyone tell me how to do this?谁能告诉我该怎么做?

I am using the following environment:我正在使用以下环境:

  • IDE: VS2019 IDE:VS2019
  • Device: Samsung Galaxy Tab Active Pro设备:三星 Galaxy Tab Active Pro
  • Android: 9 Android:9
  • Packages:套餐:
    • Xamarin.Android.Support.Core.Utils
    • Xamarin.Android.Support.Design
    • Xamarin.Android.Support.Supportv4
    • Xamarin.Essentials

Thank you for your time.感谢您的时间。

So I have found no evidence that in Android you can add a custom setting to the Android Settings app (Android Settings/Apps/App Setting for the app).因此,我没有发现任何证据表明在 Android 中您可以将自定义设置添加到 Android 设置应用程序(应用程序的 Android 设置/应用程序/应用程序设置)。 Instead I have opted to save a file with my setting value to Xamarin.Essentials.AppDataDirectory , and this way App Wrapping can be used to pre-configure config value they want in the file.相反,我选择将带有我的设置值的文件保存到Xamarin.Essentials.AppDataDirectory ,这样可以使用 App Wrapping 在文件中预先配置他们想要的配置值。 If the file is not there when the app starts then I prompt the user for the value on first start-up and write it there.如果应用程序启动时文件不存在,那么我会在第一次启动时提示用户输入值并将其写入那里。 So it can either be pre-configured via App Wrapping or the user can enter it.所以它既可以通过 App Wrapping 预先配置,也可以由用户输入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 xamarin android 应用程序中创建应用程序设置,该应用程序显示在该应用程序的 Android 设置/应用程序/应用程序设置中? - How to create an app setting in an xamarin android app that shows in the Android Settings/Apps/App Setting for that app? Xamarin Android 应用名称未设置 - Xamarin Android App name not setting 在适用于Android的应用中包装HTML - Wrapping HTML in an app for Android 如何使用 Onesignal 通知在 android 应用程序中创建通知设置页面? - How to create Notification Setting page in android app using Onesignal Notification? 应用程序中的 Android 系统小部件是否可配置? - Are Android system widgets within app configurable? 是否可以给 Android App 一个可配置的名称? - Is it possible to give and Android App a configurable name? Android应用程序中的用户可配置Firebase帐户 - User-configurable Firebase account in an Android App 如何创建 android 应用程序以通过 NFC 读取 URL? - How to create an android app to read URLs via NFC? 如何将现有的 Xamarin Android 8 应用程序更改为 Android 9? - How to change an existing Xamarin Android 8 app to Android 9? 通过 USB 连接到 Xamarin.Android 应用程序与网站通信 - Communicating with a website via usb connection to a Xamarin.Android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM