Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在冒险进入 MvvmCross 领域并取得一些不错的进展,但遇到了一些我自己无法弄清楚的事情。我目前有一个将一直运行的 android 服务。该服务将在系统启动时或应用程序首次启动时启动。
该服务/广播接收器将需要访问使用 MvvmCross 在 PCL 项目中创建的 DataService。我无法弄清楚如何在创建服务时将实例化的数据服务放入该服务/广播接收器,因为没有任何与该服务相关联的视图模型。
我知道这可能相对简单,但我自己还没有弄清楚。
最简单的方法可能是只要求Setup在服务的第一部分完成完整OnCreate:
Setup
OnCreate
var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(ApplicationContext); setupSingleton.EnsureInitialized();