android - 在应用启动时从 Web 服务加载数据
问题描述
在我的 nativescript 应用程序中,我需要缓存从 Web 服务返回的数据。我应该在哪个确切位置调用从我的 Web 服务获取数据以将其存储在 appSettings 中?
如果我把它放在下面指定的位置:
applicationOn(launchEvent, function (args: ApplicationEventData) {
if (args.android) {
**WEB SERVICE CALL HERE**
} else if (args.ios !== undefined) {
// For iOS applications, args.ios is NSDictionary (launchOptions).
console.log("Launched iOS application with options: " + args.ios);
}
});
它根本不会被执行。没有错误或没有异常。
解决方案
推荐阅读
- java - 如何修复“预期的 BEGIN_OBJECT 但是 BEGIN_ARRAY”?
- jquery - 实现步进器 jquery 初始化
- react-native - React native - “这个浏览器缺乏缓冲区 v5.x 所需的类型化数组 (Uint8Array) 支持。如果……,请使用缓冲区 v4.x
- javascript - 如何旋转引导表(横向视图)?
- text - 如何将文本文件重新排列成列?
- python - Grouby并在Python中的多列数据框中填充缺失的月份
- python - 使自定义记录器跨多个模块可用
- java - RabbitHandler:如何正确捕获“ListenerExecutionFailedException:侦听器方法'不匹配'抛出异常”并继续工作
- xml - 如何在 Schematron 中结合命名空间和元素路径?
- javascript - 如何将重点放在渲染循环中动态创建的 redux 表单上