MobileFirst 6.3 - 在混合应用程序iOS环境中启用背景中的位置触发器 [英] MobileFirst 6.3 - Enabling location trigger in Background in Hybrid Applications for iOS environment

查看:122
本文介绍了MobileFirst 6.3 - 在混合应用程序iOS环境中启用背景中的位置触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MobileFirst Platform 6.3,我试图为Android和iOS实现一个混合应用程序,我在其中创建了进入/退出位置触发器,并且enableHighAccuracy = true,应用程序应该始终听取当它在前景和背景中时触发。

在为这两种环境(Android,iOS)添加正确权限后,如知识中心链接中所述: http://www-01.ibm.com/support /knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.dev.doc/dev/r_wl_location.html?lang=en



我测试了应用在Android中,当它处于前台和后台时,按预期工作,当地理位置触发器被获取时,我只在LogCat中记录消息。



在iOS中,它无法按预期工作。它在前台正常工作,但不在后台。我正在使用XCode的iPhone模拟器进行测试,它不会在XCode控制台处于后台时记录消息。但是,当我检查了模拟器中的隐私设置时,它表示该应用程序有权获取总是处于前景和背景中的位置!!

请指教,如果有另一个设置应该使它在iOS中工作,并且这是一种正常行为,那么当应用程序在后台运行时,日志记录不起作用?

如果您希望应用在后台工作,请不要使用提醒,因为它会让应用在每次尝试执行提醒时停止。这在Android中不会发生。因此,当我在位置触发器的回调中删除警报时,它可以正常记录控制台并正常获取位置。


I'm using MobileFirst Platform 6.3, I'm trying to implement a Hybrid Application for Android and iOS, where I have created enter/exit location triggers in it, with "enableHighAccuracy=true", the application should always listen to the triggers when it is in the foreground and background.

After adding the right permissions for both environments (Android, iOS), as stated in the KnowledgeCenter link: http://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.dev.doc/dev/r_wl_location.html?lang=en

I have tested the app in Android and it is working as expected, when it is in the foreground and background, where I just log a message in the LogCat when the geo location trigger is acquired.

While in iOS, it does not work as expected. It works correctly in the foreground, but not in the background. I was testing using the iPhone Simulator of XCode, it does not log the messages in the XCode Console when it is in the background. However when I have checked the Privacy Settings in the Simulator , it indicated that the app has permissions to acquire the location "Always , in foreground and background"!!

Please advice, if there is another setting that should be made to make it work in iOS, and if it is a normal behavior that the logging does not work when the app is running in the background?

解决方案

The Answer is in iOS if you want the app to work in the background, DO NOT USE alerts, as it makes the app to stop at each alert trying to execute it. That does not happen in Android. So when I have removed the alerts in the callback of the location triggers, it worked fine logging in the console and acquiring the location normally.

这篇关于MobileFirst 6.3 - 在混合应用程序iOS环境中启用背景中的位置触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆