简体   繁体   English

如何通过使用cordova在android应用中设置时间来触发动作?

[英]How trigger an action by setting a time in android app using cordova?

The user should able to set a date and time in future and when the time has come the app should automatically call a function x(). 用户应该能够在将来设置日期和时间,并且当时间到了时,应用程序应自动调用函数x()。 Is there any CORDOVA pulgin to do this and how can I use it? 是否有任何CORDOVA制浆剂可以做到这一点,我该如何使用?

Thanks, Amir 谢谢,阿米尔

You dont need cordova to achieve that, you can do in JS with something like this: 您不需要cordova即可实现这一目标,您可以在JS中执行以下操作:

function delayFunction (delay) {

    setTimeout(function(){ 
        yourFunction();
    }, delay);

}

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

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