0

I want to schedule my job like "ScheduleDownload.class" using cron Exprssion

Here is my following code

SchedulerFactory sf=new StdSchedulerFactory();

    Scheduler sched=sf.getScheduler();

JobDetail jd=new JobDetail("job1","group1",ScheduleDownload.class);

CronTrigger ct=new CronTrigger("cronTrigger","group2",SchdExp);

sched.scheduleJob(jd,ct);

sched.start();

But it giving me the following error

03-16 09:56:21.242: ERROR/AndroidRuntime(1852): Uncaught handler: thread main exiting due 
to uncaught exception

03-16 09:56:21.251: ERROR/AndroidRuntime(1852): java.lang.VerifyError: org.quartz.impl.StdSchedulerFactory

03-16 09:56:21.251: ERROR/AndroidRuntime(1852):     at com.kochar.scheduler.scheduler.CronTriggerdownload(scheduler.java:65)

03-16 09:56:21.251: ERROR/AndroidRuntime(1852):     at 
com.kochar.scheduler.scheduler.onCreate(scheduler.java:50)

03-16 09:56:21.251: ERROR/AndroidRuntime(1852):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)

03-16 09:56:21.251: ERROR/AndroidRuntime(1852):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)

Please help, what i have to do remove this error?

Thanks

Reno
  • 33,594
  • 11
  • 89
  • 102
Karan
  • 497
  • 10
  • 23

2 Answers2

0

I don't believe that Quartz is compatible with Android. Anyway, you can see this question on what can cause a java.lang.VerifyError in Android. You should at least try to process Quartz jar files with the "dx" tool that ships with the Android SDK.

Community
  • 1
  • 1
kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
  • Then what is other alternative i should use for scheduling the jobs – Karan Mar 16 '11 at 06:05
  • Try http://developer.android.com/reference/android/app/AlarmManager.html. You need to make a distinction between cases when the device will go to sleep before the event is fired and short term intervals. – kgiannakakis Mar 16 '11 at 07:13
  • hi, i had serach on neet but unable to convert jar file to dex. – Karan Mar 16 '11 at 11:10
  • write a class which solve cron Expression and schedule the task using timer and its working fine for me now – Karan Apr 02 '11 at 03:30
  • @Karan Is it possible to using cron and AlarmManager together?! – Dr.jacky May 12 '15 at 04:28
0

Take a look to the BuzzBox SDK scheduler, it supports a cron expression and gives you other nice features specific for Android.

http://hub.buzzbox.com/android-sdk/scheduler

robsf
  • 1,713
  • 3
  • 14
  • 26
  • Thanks for the reply i had tried do use it but it does not tell in detail how to use it...can give any Good Example how to implement Buzz scheduler... as i want to schedule my task using cron Expression – Karan Mar 19 '11 at 06:13
  • Start from the Hello World App [http://hub.buzzbox.com/android-sdk/hello-world] the full source code is available for download – robsf Mar 22 '11 at 17:45