[英]how to capture if an application has been opened? (NativeScript)
I would like to capture an event when an application is opened. 我想在打开应用程序时捕获一个事件。
Ex: The Waze app is open, from this moment I would like to capture an event and decide whether the application can continue its running or not . 实例:在Waze的应用程序是开放的,从这一刻开始,我想捕捉事件,并决定申请是否可以继续运行与否 。
Yes you can do in Ionic you can see .run function in ionic inside that you can write a function for the app what it should do when it is opened. 是的,您可以在Ionic中进行操作,可以在ionic中看到.run函数,您可以为该应用编写函数,该函数在打开时应执行的操作。
app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
// write your function for capturing an event and make it use where ever you need.
});
})
.run will run automatically when an app is open and set everything you need for that app so try do you your stuff inside it so that will make you easy for you task .run将在应用打开时自动运行,并设置该应用所需的所有内容,因此请尝试在其中添加内容,以便您轻松完成任务
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.