如何创建运行应用程序甚至用户关闭它的android(how can i create run app even user close it android)

编程入门 行业动态 更新时间:2024-10-10 01:20:26
如何创建运行应用程序甚至用户关闭它的android(how can i create run app even user close it android)

想要创建应用程序cordova和离子为Android到alaram在某些时候像2:50我希望程序运行甚至关闭程序我使用katzer / cordova-plugin-background-mode插件,但当我关闭程序,它是关闭,不要仍然在后台运行这是代码

// Run when the device is ready document.addEventListener('deviceready', function () { // Android customization // To indicate that the app is executing tasks in background and being paused would disrupt the user. // The plug-in has to create a notification while in background - like a download progress bar. cordova.plugins.backgroundMode.setDefaults({ title: 'TheTitleOfYourProcess', text: 'Executing background tasks.' }); // Enable background mode cordova.plugins.backgroundMode.enable(); // Called when background mode has been activated cordova.plugins.backgroundMode.onactivate = function () { // Set an interval of 3 seconds (3000 milliseconds) setInterval(function () { var dd = new date(); var h = dd.getHours(); var m = dd.getMinutes(); if(h == 2 && m ==50){ alert("2:50"); } }, 3000); } }, false);

如何让应用程序仍然运行甚至用户关闭程序,如闹钟或一些程序提醒?

want create app cordova and ionic for android to alaram in some times like 2:50 and i want program run even close the program i use katzer/cordova-plugin-background-mode plugin , but when i close program , it be close and dont still run in background this is code

// Run when the device is ready document.addEventListener('deviceready', function () { // Android customization // To indicate that the app is executing tasks in background and being paused would disrupt the user. // The plug-in has to create a notification while in background - like a download progress bar. cordova.plugins.backgroundMode.setDefaults({ title: 'TheTitleOfYourProcess', text: 'Executing background tasks.' }); // Enable background mode cordova.plugins.backgroundMode.enable(); // Called when background mode has been activated cordova.plugins.backgroundMode.onactivate = function () { // Set an interval of 3 seconds (3000 milliseconds) setInterval(function () { var dd = new date(); var h = dd.getHours(); var m = dd.getMinutes(); if(h == 2 && m ==50){ alert("2:50"); } }, 3000); } }, false);

how can i make app still run even user close the program like , alarm clock or some program reminder ?

最满意答案

你有没有尝试过:

http://developer.android.com/guide/components/services.html

这可能会有所帮助

Have you tried:

http://developer.android.com/guide/components/services.html

this might be helpful

更多推荐

本文发布于:2023-07-29 03:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1311961.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   用户   android   create   close

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!