我正在尝试使用超循环在org.appcelerator.titanium.TiApplication中使用isCurrentActivityInForeground方法
我已经尝试了以下和其他一些方法,但我无法要求这个类-有什么建议吗?
var TiApplicationClass = require('org.appcelerator.titanium.TiApplication');
var TiApplication = new TiApplicationClass;
var isInForeground = TiApplication.isCurrentActivityInForeground();
Ti.API.log("isInForeground");
Ti.API.log(isInForeground);PS。我在闲置的渠道中问了很多次,但都没有帮助。
发布于 2018-05-09 18:31:44
我认为您需要的是benCoding.Android.Tools模块:https://github.com/benbahrenburg/benCoding.Android.Tools
if (OS_ANDROID) {
var platformTools = require('bencoding.android.tools').createPlatform(),
wasInForeGround = true;
setInterval(function() {
var isInForeground = platformTools.isInForeground();
if (wasInForeGround !== isInForeground) {
Ti.App.fireEvent(isInForeground ? 'resumed' : 'paused');
wasInForeGround = isInForeground;
}
}, 3000);
}Fokke Zandbergen的示例代码信用:http://www.tidev.io/2014/01/28/paused-resumed-events-on-android/
发布于 2018-05-10 21:57:18
到目前为止还不能通过Hyperloop访问内部SDK类。但是我喜欢这个想法!您是否可以在Appcelerator JIRA中创建票证,以便对其进行计划?
https://stackoverflow.com/questions/50245392
复制相似问题