parse.com - Integrating parse notifications code into existing android code -
i trying integrate parse notification code working existing android project....but shows errors.... heres code mainactivity.java
public class mainactivity extends activity implements onclicklistener{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); parseanalytics.trackappopenedinbackground(getintent()); pushservice.setdefaultpushcallback(this, mainactivity.class); parseinstallation.getcurrentinstallation().saveinbackground(); button ib=(button) findviewbyid(r.id.about); button ib1=(button) findviewbyid(r.id.sponsors); button ib2=(button) findviewbyid(r.id.events); button ib3=(button) findviewbyid(r.id.gallery); button ib4=(button) findviewbyid(r.id.faq); button ib5=(button) findviewbyid(r.id.contact); typeface f=typeface.createfromasset(getassets(), "recognition.ttf"); ib.settypeface(f); ib1.settypeface(f); ib2.settypeface(f); ib3.settypeface(f); ib4.settypeface(f); ib5.settypeface(f); ib.setonclicklistener(this); ib1.setonclicklistener(this); ib2.setonclicklistener(this); ib3.setonclicklistener(this); ib4.setonclicklistener(this); ib5.setonclicklistener(this); } @override public void onclick(view arg0) { // todo auto-generated method stub switch(arg0.getid()) { case r.id.about: intent i=new intent("com.svu.rhapsody.about"); startactivity(i); break; case r.id.sponsors: break; case r.id.events: intent j=new intent("com.svu.rhapsody.events"); startactivity(j); break; case r.id.gallery: intent k=new intent("com.svu.rhapsody.gallery"); startactivity(k); break; case r.id.faq: intent p=new intent("com.svu.rhapsody.faq"); startactivity(p); break; case r.id.contact: break; } }
parseapplication.java
public class parseapplication extends application{ @override public void oncreate() { // todo auto-generated method stub super.oncreate(); parse.initialize(this, app, secret); parseuser.enableautomaticuser(); parseacl defaultacl = new parseacl(); defaultacl.setpublicreadaccess(true); parseacl.setdefaultacl(defaultacl, true); parseinstallation.getcurrentinstallation().saveinbackground(); }
receiver.java
public class receiver extends parsepushbroadcastreceiver{ @override protected void onpushopen(context arg0, intent arg1) { // todo auto-generated method stub super.onpushopen(arg0, arg1); intent = new intent(arg0,mainactivity.class); i.putextras(arg1.getextras()); i.setflags(intent.flag_activity_new_task); arg0.startactivity(i); }
androidmanifest.xml
<uses-sdk android:minsdkversion="11" android:targetsdkversion="11" /> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <uses-permission android:name="android.permission.vibrate" /> <uses-permission android:name="android.permission.wake_lock"/> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <permission android:protectionlevel="signature" android:name="com.example.parse.permission.c2d_message" /> <uses-permission android:name="com.example.parse.permission.c2d_message" /> <application android:allowbackup="true" android:name="com.svu.rhapsody.parseapplication" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.svu.rhapsody.back" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.mainactivity" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.about" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.about" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.events" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.events" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.gallery" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.gallery" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.faq" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.faq" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.register" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.register" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.sing" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.sing" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity><activity android:name="com.svu.rhapsody.treasure" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.treasure" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="com.svu.rhapsody.email" android:label="@string/app_name" > <intent-filter> <action android:name="com.svu.rhapsody.email" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <service android:name="com.parse.pushservice" /> <receiver android:name="com.parse.parsebroadcastreceiver" > <intent-filter> <action android:name="android.intent.action.boot_completed" /> <action android:name="android.intent.action.user_present" /> </intent-filter> </receiver> <receiver android:name="com.svu.rhapsody.receiver" android:exported="false" > <intent-filter> <action android:name="com.parse.push.intent.receive" /> <action android:name="com.parse.push.intent.delete" /> <action android:name="com.parse.push.intent.open" /> </intent-filter> </receiver> </application> </manifest>
logcat details :
04-26 02:08:51.595: i/dalvikvm(877): not find method com.parse.parse.initialize, referenced method com.svu.rhapsody.parseapplication.oncreate
04-26 02:08:51.595: w/dalvikvm(877): vfy: unable resolve static method 40: lcom/parse/parse;.initialize (landroid/content/context;ljava/lang/string;ljava/lang/string;)v 04-26 02:08:51.595: d/dalvikvm(877): vfy: replacing opcode 0x71 @ 0x0008 04-26 02:08:51.633: d/androidruntime(877): shutting down vm 04-26 02:08:51.635: w/dalvikvm(877): threadid=1: thread exiting uncaught exception (group=0x40014760) 04-26 02:08:51.685: e/androidruntime(877): fatal exception: main 04-26 02:08:51.685: e/androidruntime(877): java.lang.noclassdeffounderror: com.parse.parse 04-26 02:08:51.685: e/androidruntime(877): @ com.svu.rhapsody.parseapplication.oncreate(parseapplication.java:16) 04-26 02:08:51.685: e/androidruntime(877): @ android.app.instrumentation.callapplicationoncreate(instrumentation.java:968) 04-26 02:08:51.685: e/androidruntime(877): @ android.app.activitythread.handlebindapplication(activitythread.java:3580) 04-26 02:08:51.685: e/androidruntime(877): @ android.app.activitythread.access$2200(activitythread.java:123) 04-26 02:08:51.685: e/androidruntime(877): @ android.app.activitythread$h.handlemessage(activitythread.java:1031) 04-26 02:08:51.685: e/androidruntime(877): @ android.os.handler.dispatchmessage(handler.java:99) 04-26 02:08:51.685: e/androidruntime(877): @ android.os.looper.loop(looper.java:126) 04-26 02:08:51.685: e/androidruntime(877): @ android.app.activitythread.main(activitythread.java:3997) 04-26 02:08:51.685: e/androidruntime(877): @ java.lang.reflect.method.invokenative(native method) 04-26 02:08:51.685: e/androidruntime(877): @ java.lang.reflect.method.invoke(method.java:491) 04-26 02:08:51.685: e/androidruntime(877): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:841) 04-26 02:08:51.685: e/androidruntime(877): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:599) 04-26 02:08:51.685: e/androidruntime(877): @ dalvik.system.nativestart.main(native method) 04-26 02:13:51.835: i/process(877): sending signal. pid: 877 sig: 9
in logs can find got java.lang.noclassdeffounderror. can check this answer, hope it'll help
Comments
Post a Comment