Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the alarm silently #26

Open
eseriestv opened this issue Aug 29, 2014 · 3 comments
Open

Run the alarm silently #26

eseriestv opened this issue Aug 29, 2014 · 3 comments
Labels

Comments

@eseriestv
Copy link

Hello,

First of all, thank you for sharing your magnificent work.

I understand that functions that will be performed when the alarm is triggered must be set in the function
function handleExtras(data)

What I want to achieve is that when the alarm is triggered, the function I place there dont open the app, just perform the actions and then show a notification to the user if needed. How can I do that? I tried placing navigator.app.exitApp; but doesnt seem to exit the app.

I dont want to annoy the user and dont want the user know the app was running in the background.

I also noted your background service plugin but dont know java very well to program in native. Also, since this alarm will work only once at day, Im not sure if its viable to use a background service, cause it seems to waste device's resources that way (not sure about this last thing).

Thank you

@Red-Folder
Copy link
Owner

Unfortunately neither plugin will work the way you want.

The Scheduler plugin is designed to launch Cordova/ Phonegap app - so great for running Javascript, but will take over the screen.

The Background plugin is designed to run code in the background (nothing on screen) - but the logic has to written in Java - plus it is expecting to run on a regular basis - so might be too much for once a day.

Both plugins can be amended to better reflect what you want, but it would require java work

@eseriestv
Copy link
Author

Dear friend,

Thank you so much for your reply. I havent solved this feature for my app yet.

I believe I can handle the java code following tuts, but as you said, your background service doesnt fit this particular schedule.

Is there a way to modify your scheduler plugin to run specific java code without opening the app? What files in particular should I edit or where should I place the code to run and not opening the app.

Thank you

@Red-Folder
Copy link
Owner

The alarm is handled by the AlarmBroadcastReceiver.java. You can amend the onReceive to do anything you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants