Comments (7)
It is currently working in my projects, but with Android there could be many factors at play here. Could you check what DDMS says when you run you code. It should print the reminder frequency in milliseconds to the window.
If you send me a sample of what you are trying to run I'll take a look at it next weekend. If possible please post to gist so I can put some tests around it.
from bencoding.alarmmanager.
Hello,
I was able to do some testing around this and it is working. You might be having an issue with it waking up the device so I pushed an update with the RTC_WAKEUP set to help avoid this.
Please note the following:
- If your service is already running, it won't run again as the Alarm Manager simply makes sure it is running. In the future you'll be able to create an interval service but at the current time I don't have a need for this feature. If you look in AlarmServiceListener there is an example on how to set an interval.
- The switch to RTC_WAKEUP helps in many scenarios but so have a few side effects. I'm not sure how you are implementing your timer functions but please be aware this will have an impact.
The easiest way to test is to use the sample project and DDMS. If you load the sample project, and press the #6 button you will see a few things. First it will launch the service after about 2 minutes. Then approx. each minute you will see the message "Service is already running no need for us to start".
If you don't see the messages you'll want to make sure you have the service name correct. To check this open your AndroidManifest.xml file in your build/android directory. You need to make sure the service name provided in the correct service name in your AndroidManifest.xml. For example the sample app passes in a service name of com.appworkbench.alarmtest.TestserviceService and you can see this within the AndroidManifest.xml as
<service android:name="com.appworkbench.alarmtest.TestserviceService"/>
Hope this helps. If you have any more questions please feel free to re-open the issue.
from bencoding.alarmmanager.
Hi,
OK, So I tried your new Example. and now I can get the repeat service to fire... however it only fires once?
var btn6 = Ti.UI.createButton({
title:"Alarm & Service Basic Repeat", top:180, right:5, width: 150, height:75
});
win.add(btn6);
btn6.addEventListener('click',function(e){
alarmManager.addAlarmService({
//The full name for the service to be called. Find this in your AndroidManifest.xml Titanium creates
service:'com.appworkbench.alarmtest.TestserviceService',
minute:1, //Set the number of minutes until the alarm should go off
repeat:60000 //You can use the words hourly,daily,weekly,monthly,yearly or you can provide milliseconds.
//Or as shown above you can provide the millesecond value
});
var ew = Ti.UI.createAlertDialog({
title:'Info', message:"The Service provided will be started in about 2 minutes & repeat each minute",
buttonNames:[Ti.Android.currentActivity.getString(Ti.Android.R.string.ok)]
});
ew.show();
});
The debug outputs:
[WARN][TiJSIntervalService( 335)] (main) [16,63841] The intent is missing the extra value 'interval', therefore the code will be executed only once.
[INFO][TiAPI ( 335)] Test Service!!!!!!
[INFO][ALERT ( 335)] (KrollRuntimeThread) [696,64538] Hello from the test service
from bencoding.alarmmanager.
If you open DDMS you'll see that after 2 minutes it will tell you that "Service is already running no need for us to start".
When I designed the module, my thought was this would just be a bridge into Titanium. If you want to use the module to re-execute the service code on the timed frequency you will need to stop the service within Titanium.
Here is a link to the Titanium documentation around how to do this.
http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.Android.Service
When I add in the sound option, I'll also provide a parameter to force a restart. I'll try to get a new build out this evening, but will have it available no later then June 9th ( in case I don't get time this weekend ).
from bencoding.alarmmanager.
Hi,
Thanks for explaining, it all makes sense now, and I did indeed get it working how I wanted by adding...
var service = Titanium.Android.currentService;
var intent = service.intent;
Ti.Android.stopService(intent);
To the testservice.js file. Thought I would post in case it could help someone else.
from bencoding.alarmmanager.
I just added an option called forceRestart that will kill your service and restart it if it is already running.
Additionally there is a new parameter called interval that allows you to create an interval service.
from bencoding.alarmmanager.
Hi benbahrenburg how are u ?
now i have an issus i hope u help me when i close my mobile device the application notfications service stop what can i do with this issus could u help me ?
from bencoding.alarmmanager.
Related Issues (20)
- Delay when Add new Alarm. HOT 3
- icon property works only partly HOT 3
- alarm sound only works first time
- PR:: adding of parameter 'itemId' to 'addAlarmService'
- When app is closed, and the service is running, app unable to show notification
- Example tiapp.xml
- I tested sdk 4.0.0 GA but not working HOT 1
- how to actually cancel an alarm? cancelAlarmNotification doesn't work as I expect
- how to actually cancel all alarms? cancelNotifications doesn't work as I expect HOT 2
- How to cancel a notification!
- Repeat daily
- If application is in background or not running AlarmService doesn't trigger
- Compile error HOT 1
- Custom sound is not work on Android 6.0 or higher
- Alarm not fires on time HOT 1
- Recieve yearly Notification every day
- Custom sound not playing HOT 7
- bencoding.alarmmanager module 0.16 version greyed out and apiversion is 23 in manifest HOT 3
- Unsatisfied Symbol on API 25 with Ti SDK >= 7 HOT 3
- Notification not working for Android 7.0+ devices HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bencoding.alarmmanager.