Monday, April 18, 2016

Registering with GCM Checkpoint Part II - Udacity Advance Android Course

Di part I kita udah nambain kelas2 servicenya, cuman kelasnya masih pada kosong. Naah disini baru kita isi hehe.. :D
Pertama-tama kita tambain konstanta string baru di MainActivity.java kyk gini :
terus berikutnya yang kelas service RegistrationIntentService.java kyk gini :
Teruuuus.... kee MyInstanceIDListenerService.java :
Mmm...terus balik ke mainActivity didalam fungsi onCreate :

okieeee..... selese daaah... :)
Coba di run..... daaaan....ternyata ada yang error... :v
Katanya :
FATAL EXCEPTION: main   Process: com.example.android.sunshine.app, PID: 2517
 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.sunshine.app/com.example.android.sunshine.app.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.android.sunshine.app/com.example.android.sunshine.app.gcm.RegistrationIntentService}; have you declared this activity in your AndroidManifest.xml?    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)

Kode yang salah di MainActivity itu yang ini :

Daaan... errornya tuuh... karena emulatornya g' pake google play service eheheh... jadi klu di run di real device, sunshinenya okie okie.. ajjah... :)... sooo it's fixed.. :D

--- Next Quizz

No comments:

Post a Comment