我正在使用Ionic 2 rc4。
我有一个更新用户上次访问时间戳的功能。
每次访问应用程序时我都需要执行此功能。有什么地方可以做这个电话吗?
我考虑过在app.component.ts
的{{1}}中进行调用,但我认为这只会在应用启动时调用一次,除非应用被杀,否则不会再次调用
由于
答案 0 :(得分:1)
我认为你需要这个:
platform.ready().then((readySource) => {
this.platform.pause.subscribe(() => {
//App paused or closed
});
this.platform.resume.subscribe(() => {
//App resumed or start
});
});
将此代码放入MyApp构造函数中。