Dear All,
I am using an adapted code from the web for sending sms via gsm modem. Now I would like to modify to read sms message from database table and send it.So I would like to programme it to read on every 30 second from the db process and send the message. What will be best method is it timer or cronjob? Thank you.
newbie14 0 Posting Pro
Recommended Answers
Jump to PostThe normal way to run a method every 30 secs is to use a java Timer.
See the API docs for java.util.Timer (not javax.swing.Timer) for details, or example here:
http://www.exampledepot.com/egs/java.util/ScheduleRepeat.html
Jump to Postpublic void run() {
t1.sendMessage(phoneNumber,messageSend);
}
Jump to Postam I right
Don't ask me - ask Java! Did you run it? What did it do?
20,000 mSec is 20 secs, yes.
The delay is the time before the first call to your run. so for example
0,20000 runs immediately, then every 20 secs after
60000,20000 runs after …
All 12 Replies
pbl 22 Junior Poster
newbie14 0 Posting Pro
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
newbie14 0 Posting Pro
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
newbie14 0 Posting Pro
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
newbie14 0 Posting Pro
purijatin 0 Light Poster
purijatin 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
newbie14 0 Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.