android - Class init failed in newInstance call : for IntentService called from alarmManager -


i trying use intentservice alarmmanager schedule alarms. have used broadcast reciever further calls intentservice here code :

setting alarm:

public static integer createscheduledalarm(calendar calendar,         int intervalseconds, context context) {      alarmmanager alarmmanager = (alarmmanager) context             .getsystemservice(context.alarm_service);      int id = (int) system.currenttimemillis();      intent intent = new intent(context,             com.stressfree.alerts.timealarm.class);       pendingintent pendingintent = pendingintent.getbroadcast(context, id,             intent, pendingintent.flag_update_current);      if (intervalseconds > 0) {         alarmmanager.setrepeating(alarmmanager.rtc_wakeup,                 calendar.gettimeinmillis(), intervalseconds * 1000,                 pendingintent);     }        return id; } 

here broadcast reciever class:

public class timealarm extends broadcastreceiver {  @override public void onreceive(context context, intent intent) {     //bundle bundle = intent.getextras();     intent taskservice = new intent(context, taskservice.class);     //taskservice.putextras(bundle);     context.startservice(taskservice);     } } 

and have below intentservice class getting current location of user:

public class taskservice extends intentservice implements googleplayservicesclient.connectioncallbacks, googleplayservicesclient.onconnectionfailedlistener{   public taskservice() {     super("taskservice"); }  private locationclient locationclient; private location mcurrentlocation; private context mcontext;    @override protected void onhandleintent(intent intent) {      log.e("service", "inside onhandleintent");     mcontext = this;     int resp = googleplayservicesutil.isgoogleplayservicesavailable(this);     if (resp == connectionresult.success) {         locationclient = new locationclient(this, this, this);         locationclient.connect();     }  } @override public void onconnectionfailed(connectionresult arg0) {     // todo auto-generated method stub  }  @override public void onconnected(bundle arg0) {     mcurrentlocation = locationclient.getlastlocation();     //do stuff }  @override public void ondisconnected() {     // todo auto-generated method stub  } 

in manifest have registered reciever , service :

        <receiver android:name=".timealarm" />         <service android:name=".services.taskservice" > 

but when alarm fires on set time doesn't breakpoint @ onreceive of broadcast reciever. , error intentservice. here error log :

06-26 11:22:20.068: w/dalvikvm(4070): vfy: register1 v2 type 17, wanted 18 06-26 11:22:20.068: w/dalvikvm(4070): vfy:  rejecting opcode 0x2e @ 0x005c 06-26 11:22:20.073: w/dalvikvm(4070): vfy:  rejected lcom/stressfree/services/taskservice;.onconnected (landroid/os/bundle;)v 06-26 11:22:20.073: w/dalvikvm(4070): verifier rejected class lcom/stressfree/services/taskservice; 06-26 11:22:20.073: w/dalvikvm(4070): class init failed in newinstance call (lcom/stressfree/services/taskservice;) 06-26 11:22:20.073: d/androidruntime(4070): shutting down vm 06-26 11:22:20.078: w/dalvikvm(4070): threadid=1: thread exiting uncaught exception (group=0x40c321f8)   06-26 11:22:20.088: e/androidruntime(4070): fatal exception: main 06-26 11:22:20.088: e/androidruntime(4070): java.lang.verifyerror: com/stressfree/services/taskservice 06-26 11:22:20.088: e/androidruntime(4070):     @ java.lang.class.newinstanceimpl(native method) 06-26 11:22:20.088: e/androidruntime(4070):     @ java.lang.class.newinstance(class.java:1319) 06-26 11:22:20.088: e/androidruntime(4070):     @ android.app.activitythread.handlecreateservice(activitythread.java:2246) 06-26 11:22:20.088: e/androidruntime(4070):     @ android.app.activitythread.access$1600(activitythread.java:127) 06-26 11:22:20.088: e/androidruntime(4070):     @ android.app.activitythread$h.handlemessage(activitythread.java:1213) 06-26 11:22:20.088: e/androidruntime(4070):     @ android.os.handler.dispatchmessage(handler.java:99) 06-26 11:22:20.088: e/androidruntime(4070):     @ android.os.looper.loop(looper.java:137) 06-26 11:22:20.088: e/androidruntime(4070):     @ android.app.activitythread.main(activitythread.java:4507) 06-26 11:22:20.088: e/androidruntime(4070):     @ java.lang.reflect.method.invokenative(native method) 06-26 11:22:20.088: e/androidruntime(4070):     @ java.lang.reflect.method.invoke(method.java:511) 06-26 11:22:20.088: e/androidruntime(4070):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:790) 06-26 11:22:20.088: e/androidruntime(4070):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:557) 06-26 11:22:20.088: e/androidruntime(4070):     @ dalvik.system.nativestart.main(native method) 

try add constructor service accepts string param 'name' , pass constructor of super


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -