Javascript Nativescript实时设备日期和时间
有没有办法让我知道设备的日期和时间?自动的那个。如果用户禁用自动输入日期和时间并选择自己的日期和时间,则会使我的应用程序崩溃。我也在使用firebase,在iOS上无法检测到这些信息,但在Android上你可以这样做Javascript Nativescript实时设备日期和时间,javascript,angular,firebase,nativescript,Javascript,Angular,Firebase,Nativescript,有没有办法让我知道设备的日期和时间?自动的那个。如果用户禁用自动输入日期和时间并选择自己的日期和时间,则会使我的应用程序崩溃。我也在使用firebase,在iOS上无法检测到这些信息,但在Android上你可以这样做 if (application.android) { if (android.provider.Settings.Global.getInt(application.android.context.getContentResolver(), android.prov
if (application.android) {
if (android.provider.Settings.Global.getInt(application.android.context.getContentResolver(), android.provider.Settings.Global.AUTO_TIME, 0) !== 1) {
console.log("Date / Time preference is not set to auto!!!");
}
}
在iOS上,唯一的选择可能是使用简单的api将本地日期时间与服务器的日期时间进行比较,请确保包含时区信息