我正在尝试将 pwa 功能添加到在 Angular 8 上运行的网站。我遵循了很多官方和非官方的教程,但我不明白我做错了什么。
ngsw-config.json 是这样的:
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js",
"/*.min.js"
],
"urls": [
"https://fonts.googleapis.com/**"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
我可以在 Chrome 开发控制台的“应用程序”选项卡中看到服务工作线程已注册并正在运行。
但我有两个主要问题。
索引页面似乎无法提供服务,服务工作人员仍在注册并运行。
我可以在在线模式下看到我从 Service Worker 获取索引页,那么为什么它在离线模式下不起作用?
我只是想设置我下载的 Google Maven 依赖项:
https://d.android.com/r/studio-offline/downloads
我按照“自述文件”说明进行操作,然后尝试通过从项目的“build.gradle”中注释掉 jcenter() 和 google() 来验证一切正常。
错误:找不到 com.android.tools.build:gradle:4.1.2。
错误:找不到 org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30。
我正在macOS 上实现文件提供程序。我看到 OneDrive 有一个离线模式,其中包含 \xe2\x80\x98Always Keep on This Device\xe2\x80\x99 和 \xe2\x80\x98Free up Space\xe2\x80\x99 菜单:
\n\n在 Windows 上,此功能由固定和取消固定文件属性以及 CfHydratePlaceholder() 和 CfDeHydratePlaceholder() Windows API 提供。如何在 macOS 上实现此功能?是否有任何特定属性或文件提供程序 API 来支持它?
\n我正在尝试使用 Yarn 2 将模块安装到离线计算机上。
我有.tgzNPM 模块的文件。看起来可以使用 Yarn 1.x 完成,但似乎不适用于 Yarn 2。
我将文件放入lowdb-1.0.0.tgz项目文件夹的根目录中进行测试,并尝试了这些不起作用(项目配置为 Yarn 2):
yarn add lowdb-1.0.0.tgz
YN0027: lowdb-1.0.0.tgz@unknown can't be resolved to a satisfying range
YN0001: RequestError: getaddrinfo ENOTFOUND registry.yarnpkg.com
...
Run Code Online (Sandbox Code Playgroud)
yarn add ./lowdb-1.0.0.tgz
YN0000: Resolution step
YN0013: lowdb@file:./lowdb-1.0.0.tgz::locator=reaction%40workspace%3A. can't be found in the cache and will be fetched
YN0001: RequestError: getaddrinfo ENOTFOUND registry.yarnpkg.com
...
Run Code Online (Sandbox Code Playgroud)
yarn add file:./lowdb-1.0.0.tgz
Internal Error: Invalid descriptor (file:./lowdb-1.0.0.tgz)
...
Run Code Online (Sandbox Code Playgroud)
这可能与 Yarn 2 相关吗?或者是否有另一种方法可以使用 Yarn 2 使用下载的 asset/bundles/tgz 将模块直接安装到离线计算机上?
我正在尝试实现 Android 的 SpeechRecognizer 功能。由于我公司的隐私限制,数据明确不得离开设备。
迄今为止:
SpeechRecognizer.createSpeechRecognizer方法实现了 SpeechRecognizer 类。当我在没有互联网的情况下尝试时,效果很好!然而,据我所知,不能保证谷歌不会在在线时发送数据,如果不是为了转录,那么是为了改进他们的音频训练数据。SpeechRecognizer.createOnDeviceSpeechRecognizer- Android 12 及更高版本提供此功能。就说我不介意吧。但是,它仅适用于特定设备,即。Pixel 6 甚至 Pixel 4a 也没有。putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true)- 这也不起作用。ERROR_NO_MATCH在我尝试过的任何设备中,它总是给我错误: 。所以这让我们很简单SpeechRecognizer.createSpeechRecognizer,我的实现是这样的:
var recognizerIntent: Intent? = null
if (SpeechRecognizer.isRecognitionAvailable(applicationContext)) {
sr = SpeechRecognizer.createSpeechRecognizer(applicationContext)
val listener = MySpeechRecognitionListener(scopeProvider, lifecycleScope, {
...
}
sr.setRecognitionListener(listener)
recognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH)
}
sr.startListening(recognizerIntent)
} else {...}
Run Code Online (Sandbox Code Playgroud)
问题:我们能否以某种方式保证 Android 的 SpeechRecognizer 不会向 Google 发送数据?
我通常使用以下命令运行我的应用程序,同时通过 USB 调试连接我的物理设备。
npx 博览会运行:android
但现在,我需要在仍然使用 Metro 捆绑程序的同时测试离线功能。我见过的大多数建议都被使用expo start --offline,但我不使用 Expo Go,因为我有本机库。我尝试过expo start --dev-client --offline,它成功构建了该应用程序,但当我在设备上切换到飞行模式时,它与 Metro 捆绑程序失去了连接。这尤其困难,因为我需要在离线模式下启动应用程序,但我无法这样做,因为它需要连接到开发服务器。
我能看到的唯一解决方法实际上是构建一个 apk,在离线模式下安装并打开它,但随后我无法调试,因为没有地铁。使用 EAS 进行构建需要很长时间。
有什么建议么?
我需要在.NET中创建一个桌面WPF应用程序.
应用程序与Web服务器通信,并且在Web服务器不可用时可以在脱机模式下工作.
例如,应用程序需要计算用户在项目上工作的时间.应用程序连接到服务器并获取项目列表,用户选择一个项目,然后按下按钮以启动计时器.用户可以稍后停止计时器.项目启动和停止时间需要发送到服务器.
如何在应用程序处于脱机模式时实现此功能?
是否有一些现有的解决方案或一些库来简化此任务?
提前致谢.
您好,并提前感谢您,
我想问一下是否有办法编译预先知道的谷歌地图图块并在Phonegap应用程序中加载它们.
更具体地说,我正在开发一个涉及特定区域内的地理定位,路径导航等的应用程序.由于应用程序的使用性质(例如可能在野生动物中使用),用户的电话可能无法获得信号以便建立互联网连接,因此我希望交互式地图设施可用,即使手机离线.
如果之前检索到Google地图,我也会考虑获取缓存切片的可能性.这可能与Phonegap有关吗?
我也对其他地图服务的任何建议持开放态度,不仅仅是谷歌地图.
我正在编写一个Python脚本,它将纬度和经度传递给模块,并执行反向地理编码功能以返回该位置的地址.我一直在使用谷歌的PyGeoCoder来做这件事,但它需要访问互联网.我需要类似于PyGeoCoder的东西,但开源并完全脱机.
我使用TFS 2015,我看到我的构建代理处于离线状态:
我启动VsoWorker.exe来查看日志并理解错误,这是我得到的但是我从互联网上找不到任何东西:请问有什么想法吗?
16:07:57.649004 Sending trace output to log files: C:\Users\Administrator\Downloads\agent\_diag
16:07:57.649004 vsoWorker.exe was run with the following command line:
"C:\Users\Administrator\Downloads\agent\Agent\Worker\VsoWorker.exe"
16:07:57.649004 VsoWorker.Main(): Create AgentLogger
16:07:57.649980 VsoWorker.Main(): Parse command line
16:07:57.655848 ---------------------------------------------------------------------------
16:07:57.657635 System.Exception: The /name command line option is required and must have a value.
16:07:57.657635 at VsoWorker.CommandLine.ValidateCommandLine()
16:07:57.657635 at VsoWorker.CommandLine..ctor(String[] args)
16:07:57.657635 at VsoWorker.Program.Main(String[] args)
16:07:57.657635 at VsoWorker.CommandLine.ValidateCommandLine()
16:07:57.657635 at VsoWorker.CommandLine..ctor(String[] args)
16:07:57.657635 at VsoWorker.Program.Main(String[] args)
16:07:57.657635 ---------------------------------------------------------------------------
16:07:57.658878 BaseLogger.Dispose()
Run Code Online (Sandbox Code Playgroud) offline ×10
android ×2
.net ×1
angular ×1
azure-devops ×1
build-agent ×1
c# ×1
cordova ×1
expo ×1
fileprovider ×1
geocoding ×1
google-maps ×1
gradle ×1
macos ×1
maps ×1
privacy ×1
python ×1
react-native ×1
service ×1
tfs ×1
tfsbuild ×1
worker ×1
wpf ×1
yarnpkg ×1
yarnpkg-v2 ×1