【问题标题】:Implementing managed configurations in NativeScript在 NativeScript 中实现托管配置
【发布时间】:2017-08-10 14:16:01
【问题描述】:

我正在为 android 开发 NativeScript 应用程序,并希望实现如下所述的托管配置:https://developer.android.com/work/managed-configurations.html

我尝试将 app_restrictions.xml 添加到 App_Resources/Android/values 文件夹,但出现以下构建错误:

任务“:mergeF0F1DebugResources”执行失败。 错误:不支持的类型“限制”

这是app_restrictions.xml的内容:

<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
  <restriction
    android:key="downloadOnCellular"
    android:restrictionType="bool"
    android:defaultValue="true" />
</restrictions>

NativeScript 是否支持添加这样的限制?如果是这样,我该如何添加限制资源文件。如果没有,是否有其他方式来实现托管配置?

编辑:由 pkanev 在 cmets 中解决。限制文件必须放在 App_Resources/Android/xml 中。

【问题讨论】:

  • 我认为该文件应该放在xml 目录中,而不是在values 中。你能测试一下吗?
  • 构建成功,我试试看限制管理器能否访问这些值。
  • 成功了,谢谢!

标签: android nativescript android-restrictions


【解决方案1】:

根据官方 Android 文档 - https://developer.android.com/work/managed-configurations.html 限制配置需要放在res/xml dir中,对应NativeScript Android应用中的app/App_Resources/Android/xml

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    • 1970-01-01
    • 2019-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多