简体   繁体   English

获取android中应用程序的开始和结束时间以进行离子应用程序

[英]Get start and end timing of application in android for ionic application

I am trying to get the start timing and end timing of other application from android device for analysis of personal behaviour and use it in our application.我正在尝试从 android 设备获取其他应用程序的开始时间和结束时间,以分析个人行为并在我们的应用程序中使用它。 Can anyone suggest how to get those data.任何人都可以建议如何获取这些数据。 Is there any API or any framework to get these kind of data.是否有任何 API 或任何框架来获取此类数据。 Our ionic application version is Ionic 3.我们的 ionic 应用程序版本是 Ionic 3。

You can use platfrom.pause to detect if the user has put the app in the background and platform.resume if the app has opened again.您可以使用 platfrom.pause 来检测用户是否将应用程序置于后台,如果应用程序再次打开,则使用 platform.resume 。 See more here在这里查看更多

this.platform.pause.subscribe(async () => {
  // send data (like timestamp) to BE server
});
this.platform.resume.subscribe(async () => {
  // send data (like timestamp) to BE server
});

However , I recommend using Firebase + Analytics .但是,我建议使用Firebase + Analytics You will get a much more accurate analysis of personal behavior of your users.您将对用户的个人行为进行更准确的分析。 Full tutorial here完整教程在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM