如何创建运行应用程序甚至用户关闭它的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
更多推荐
发布评论