How to debug a Service?
Introduction
When you start a project with a service in it in debug mode, and you placed a breakpoint in a method of the service, the debugger will not stop.
The solution that works in almost all situation is to wait declaratively in the code for the debugger to attach. To do this, you have to make a call to:
- android.os.Debug.waitForDebugger();
The breakpoint can be inserted at any line after this call.
As a complete example, the SoftKeyboard tutorial is enhanced with the call above:
- public class SoftKeyboard extends InputMethodService
- implements KeyboardView.OnKeyboardActionListener {
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- Log.d("SoftKeyboard", "onConfigurationChanged()
"); - /* now let's wait until the debugger attaches */
- android.os.Debug.waitForDebugger();
- super.onConfigurationChanged(newConfig);
- /* do something useful... */
- }
As you can see in the code, the first call in the method is a call to the logger, with which we can see in the Log output when our method was called. This can be an other way of tracking our method calls, without the need to stop at a breakpoint. But usually this is not enough for detailed debugging.
Then the second statement waits for the debugger to attach, as it is also noted in the comment. After this line the breakpoint can be inserted anywhere in the method.
Debugging a Service in case an Activity is also part of the application is even easier. In that case the activity has to be started first, then the debugger is able to stop at the breakpoint in the service as well, without the need of an explicit waitForDebugger() call.
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@619Apps (iPhone App Developer)'Xperia Sola' trademark hints at another possible Sony handset for the U.S. - http://t.co/atxhdfFz #iPhone #android #apps
2 hours 11 min ago -
@ayakaarchdia233 (Love)I've just received an achievement: Discriminating Shopper https://t.co/LDVOSV6I #Android #Androidgames
2 hours 11 min ago -
@DevrynBluelagon (Devryn Bluelagon)I've just received an achievement: Novice Photographer https://t.co/NpjOoveN #Android #Androidgames
2 hours 11 min ago -
@games_lma (leila marie ashley)I've just received an achievement: Persistent Shopper https://t.co/vTs6DSor #Android #Androidgames
2 hours 11 min ago -
@hawkhugh (hawkhugh)Apple's iPad3 http://t.co/T9dSUJA9 #apple #ipad3 #iphone #android
2 hours 11 min ago
Poll
Useful resources
Android Development Projects
- Android App: GPS: Form: Database: Website by danishayubb
- Jquery Mobile Project 01 by menfirst
- Simple Android App to load our Mobile Site - Hiring NOW! by steadysystems
- mobile app by ultimaterrrr
- android apps by vaneet08
- Online food shopping app (anroid) by akshaynawale
- Android eBook / reader Application by bamohriz
- Android app 50k downloads by nhcteam
- Beautiful Android Live Wallpaper by wahid2o11
- App downloads by nhcteam




Comments
دردشة سورية دردشة
دردشة سورية
دردشة لبنانية
دردشة عراقية
شات سوري
شات لبناني
دردشة سوريا
دردشة لبنان
شات سوريا
شات لبنان
دردشة السويدي
منتديات السويدي
اغاني عراقية
صور فنانين
الرياضة العراقية
شعراء العراق
نغمات عراقية
اغاني عربية
اغاني كردية
دردشة عراقية
دردشة بنات العراق
دردشة صبايا بغداد
دردشة البصره
دردشة بغداد
دردشة بغدادية
دردشة صبايا بغداد
دردشة شباب العراق
دردشة بنات العراق
دردشة الكرادة
دردشة دمشق
دردشة بيروت
دردشة حلب
دردشة حلب
دردشة عراقية
دردشة العراق
شات عراقي
جات عراقي
دردشه عراقيه
دردشة صبايا لبنان
دردشة بنات لبنان
دردشة سورية دردشة
دردشة سورية
دردشة لبنانية
دردشة عراقية
شات سوري
شات لبناني
دردشة سوريا
دردشة لبنان
شات سوريا
شات لبنان
دردشة السويدي
منتديات السويدي
اغاني عراقية
صور فنانين
الرياضة العراقية
شعراء العراق
نغمات عراقية
اغاني عربية
اغاني كردية
دردشة عراقية
دردشة بنات العراق
دردشة صبايا بغداد
دردشة البصره
دردشة بغداد
دردشة بغدادية
دردشة صبايا بغداد
دردشة شباب العراق
دردشة بنات العراق
دردشة الكرادة
دردشة دمشق
دردشة بيروت
دردشة حلب
دردشة حلب
دردشة عراقية
دردشة العراق
شات عراقي
جات عراقي
دردشه عراقيه
دردشة صبايا لبنان
دردشة بنات لبنان
شات صوتي | دردشة صوتية | كلام
شات صوتي
| دردشة صوتية
|
كلام
| شات كلام
|
دردشة كلام
| دردشة صوتية
|
شات صوتي
| شات
|
Chat Voice
| ahj w,jd
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
دردشه
| دردشة
|
صوتي
| صوتية
|
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
الكلام
| دردشه صوتيه
|
]v]am w,jdm
| ]v]ai w,jdi
شات صوتي
شات صوتي
شات صوتي
very nice
You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post.
parduotuve || parduotuve || parduotuve || parduotuve || parduotuve || parduotuve
good
nice article...
by
sarang semut
Fine one.
I think you have unique and simple site.Park Hotel Brno
Android
Good post. Your articles are interesting and informative
batik clothing
nice blog
very nice article! this is really useful
behel lepas pasang
I am very interested in what
I am very interested in what you write. I think I can understand a lot for me to learn better.
Abilene Roofing Companies
nice blog
very nice article! it's very useful :)
heavenrooms.com | 5770 benchmark
Adonai
nice article...
by
sarang semut
useful
thanks for your article its really great and useful
sportbike specifications SKEMA RANGKAIAN Electronic Circuit scolarship wireless car specifications gadget and computer car first look Motorcycle Modification sexi-stars. newlaptop circuits-audio electronic projects auto girl weapons system science kids gadget bikes walpaper mobil-wallpaper MODIFIKASI MOBIL plane-wallpaper celebsexypict artist-scandal sport-cars bikespict motor-modify sexi-model laptopharga gambar-artist fast-superbike autoshowmodel harga-kamera notebook-price diamonds-collections phones-gallery camera-prices home-pic audio-gallery autocarpict living-cares homes life-style
En güzel Benten Oyunları
En güzel Benten Oyunları binlerce kaliteli oyun.
Komik Oyunlar -
Zeka Oyunları -
Araba Yarışı Oyunları -
Ben 10 Oyunları-
Oyun-
Oyun
This is your best post
thanks for sharing. This is your best post.
Masariq Blog
oke
nitip kode debug cara berkomentar di blog nofollow
Thanks,,,,,,
Thanks for the solution,,,,
Nikmaya John
Thank you - the site very
Thank you - the site very very nice
المجتمع المصري هو مجتمع يحب الترفية حيث ان سكان مصر تصل الى تسعون مليون فرد ولذلك نحن نقدم خدمة دردشة مصرية لكل اهل مصر ام الدنيا , وتعتبر مصر متقدمة فى هذا العالم من حيث النمو فى مجالات التكنولوجيا و الكمبيوتر بنسبة كبيرة جدا لذلك نفضل دخول شات مصري اكبر تجمع بنات و شباب فى شات الحب و اجمل بنات فى دردشة دردشة الحب , اضافة الى ذلك حيث يوجد دردشة قوية تضم جميع محافظات مصر هي شات مصرية الكتابية نتمني لكم قضاء وقت ممكن فى شات الاصدقاء و احلي دردشة التعارف الذي يوجد به بنات رومانسية فى دردشة بنات مصر المصرية
شات الحب - دردشة مصرية - شات - شات مصري - شات حب - دردشة - دردشة كتابية - دردشة الحب - شات حبنا - شات حبي - شات مصرية - دردشة حب - شات بنات - دردشة مصر - دردشة بنات مصر - شات بنات مصر - شات صوتي - chat love - دردشة ياحبي - شات بنات لبنان - الحب - شات كتابي - منتدي ياحبي - شات مصر - دردشة حبنا - العاب تلبيس البنات - دردشة بنات - شات ياحبي - Chat - شات لبناني - شات كلامنجي - دردشة كلامنجي - شبكة - تصميم مواقع - تصميم - شات الاسكندرية - دردشة لبنانية - دردشة بنات لبنان - بنات لبنان - موقع شات - سعودي كول - شات سعودي كول - شات بنت مصر - شات سكس
sdasfasfa
wth
amikom blogger community goes to karimunjawa
I read through your writing
I read through your writing just about every morning. The content material continues to keep me occupied and additionally it is instructive. Marvelous. download movies
توبيكات نونو توبيكات توبيكات
توبيكات نونو
توبيكات
توبيكات سعودي
توبيكات 2012
توبيكات بنات
العاب نونو
العاب
العاب بنات
games
شات لمني الصوتي
دردشة لمني الصوتية
شات صوتي لمني
شات صوتي
دردشة صوتية
دردشة
دردشه
شات سعودي
شات خليجي
سكر بنات
جات
شات صوتي سعودي خليجي
chat voice
ahj
خليجي الصوتي
سعودي الصوتي
دردشة صوتي
شات صوتي
دردشة صوتية
شات كتابي
شات كتابي خليجي
شات عسل الصوتي
دردشة كتابية
chat
سعودي كول
سعودي كول 6666
كول
سعودي
سعودي كول انحراف
سعودي كول بنات
سعودي كول 1994
chat saudi col
شات سعودي كول
سعودي انحراف
سعودي انحراف2010
سعودي انحراف الصوتي
شات سعودي انحراف
دردشة سعودي انحراف
سعودي انحراف الصوتية
شبكة سعودي انحراف
سعودي انحراف الاصلي
سعودي انحراف كول
سعودي انحراف 2010
انحراف سعودي
saudideviation
دردشة صوتية سعوديه
دردشة صوتية سعودية
دردشة كتابية
دردشة كتابية خليجية
شات
دردشة
خاص للبنات
عرب ذوق
عرب ذوق الصوتي
عرب ذوق الصوتية
دردشة عرب ذوق
شات عرب ذوق
شبكة عرب ذوق
شات صوتي بنات
شات بنات الصوتي
دردشة بنات الصوتي
Girls Chat
شبكة عفناك
صوتية عفناك
شات عفناك
دردشة عفناك
عفناك الصوتي
دردشة عفناك
الخيال
الخيال كام
شبكة الخيال
الخيال الصوتي
الخيال الصوتية
دردشة الخيال
الخيال الصوتية
دردشة صوتية الخيال
شات سعودي خليجي
منتدى نونو
منتدى
منتديات
موقع
شبكة
نونو
Chat Nono
ahj w,jd
]v]am w,jdm
دليل مواقع ويب
دليل مواقع
دليل
مواقع
بنت كول
بنت كول الصوتي
شات بنت كول
دردشة بنت كول
شات بنت كول الصوتية
بنت كول الصوتيه
سعودي كول
صوتية سعودي كول
شات سعودي كول
دردشة سعودي كول
سعودي كول الصوتي
سعودي كول 6666
سعودي كول6666
سكر بنات
شات صوتي زين
شات صوتي ملوك
شات صوتي سعودي
شاتات صوتيه
مكتبة ماسنجر
شات صوتي حبي
شات صوتي كويت
YouTube - Broadcast Yourself. , اليوتيوب نونو
صيف كام
شات صوتي كول
شات انحراف
وه بس
خريطة الموقع نونو
الرياض كول الصوتي
كامات 6666
شات المها
كامات6666
شات كامات 6666
كامات 666
كامات 66
سعودي انحراف
شاتكامات6666
سعودي احوه
شات سعودي احوه
سعودي احوه الصوتي
سعودي احوه كول
دردشة سعودي احوه
احوه سعودي
بنات احوه
دبي الصوتي
سعودي في اي بي الصوتي
شبكة الرياض الصوتي
روعة الليل
لايف كام
الخليج كام
شات كان زمان الصوتي
شات صوتي قصيمي
شات قلبي
ارجوان
شات صوتي قطري
بدور الخليج
منتدى روح
شبكة روح
روح ديزاين
تحميل ماسنجر بلس
توبيكات حزينه
توبيكات
ماسنجر
ماسنجر بلس
تحميل ماسنجر
توبيكات رومنسيه
منتديات روح
دردشة
شات سعودي
خليجي
شات صوتي
توبيك
موقع توبيكات
سعودي كول 6666
سعودي انحراف 2011
سعودي كول
سعودي انحراف
Actually I am a little
Actually I am a little confused, if the debugging process is similar to the debugging process that we find in windows? I mean like Windows' task manager. pheromone cologne
thank you for information حجز
thank you for information
حجز فنادق مكة
فنادق مكة
great post there, will
great post there, will bookmark your site aand notice the updates. Useful information like this one must be kept and maintained so I will put this one on my bookmark list. thanx.... Mercedes-Benz Mobil Mewah Terbaik Indonesia | Tablet Android Honeycomb Terbaik Murah | Mercedes-Benz Mobil Mewah Terbaik Indonesia | Meriahkan pesta ulang tahun bersama GarudaFood | Mari Berkomunitas Di Faceblog | Harga Jual Blackberry iPhone Laptop Murah | Video Music | Mp3 | Beauty and Health
This is my first time i visit
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work. Bathroom Tile Designs
Site Content Amazing, fun to
Site Content Amazing, fun to read .. Save me much time researching this topic.Hopefully to keep your blog updated so that people like me to be back and read some more
Bastrop Remodeling Contractors
How impossible
I visited your blog for the first time and just been your fan. Thanks for Share With Irfan and so you can read my last post Mari Berkomunitas Di Faceblog on my blog.
wow like this
i like this kaminomoto and for this info bro kaminomoto,penumbuh rambut
Really Really Thanks For This
Really Really Thanks For This Wonderful article. Its glad that nowadays also, there is some original content on the internet. Otherwise, everywhere you go you will find duplicate content. Thanks Again. Like to Read You article and blog.
movie download | mediafire links | all buzzy news
Android
This is such a very interesting article. Please add some
watch tv shows
Very cool !
I now have a clear idea on what this matter is all about. Thanks for Share With Irfan and so you can read my last post daftar blog dofollow 2011 terbaru on my blog.
Android
Very interesting information
watch tv shows
attention
tskler odaları
çet
çet
türkü dinle
This is one of the good
This is one of the good articles you can find in the net explaining everything in detail regarding the topic. I thank you for taking your time sharing your thoughts and ideas to a lot of readers out there. Buy Backlinks
very nice.....
Nice information on this page. I would like to read more like this.Freshersworld||IT jobs
Thank you
Thanks for the script
public class SoftKeyboard extends InputMethodService istener {
implements KeyboardView.OnKeyboardActionL
@Override ration newConfig) {
public void onConfigurationChanged(Configu
Log.d("SoftKeyboard", "onConfigurationChanged()");
/* now let's wait until the debugger attaches */ ger();
android.os.Debug.waitForDebug
super.onConfigurationChanged(n ewConfig);
/* do something useful... */
}
a visit b visit c visit d visit e visit f visit g visit h visit i visit j visit k visit l visit m visit n visit o visit p visit q visit r visit s visit t visit u visit v visit w visit x visit y visit z visit aa visit ab visit ac visit ad visit ae visit af visit ag visit ah visit ai visit aj visit ak visit al visit am visit an visit ao visit ap visit aq visit ar visit as visit at visit au visit av visit aw visit ax visit ay visit az visit ba visit bb visit bc visit bd visit be visit bf visit bg visit bh visit bi visit bk visit bl visit bm visit bn visit bo visit bp visit bq visit br visit bs visit bt visit bu visit bv visit bw visit bx visit by visit bz visit ca visit cb visit cc visit cd visit ce visit cf visit cg visit ch ci cj ck cl ccl cm cn co cp cq cr cs ct cu cv
very good
I like this concept. I visited your blog for the first time and just been your fan. Keep posting as I am gonna come to read it everyday.Home Automation
Other Solution
The solution that works in almost all situation is to wait declaratively in the code for the debugger to attach. Baju Muslim | Property Investment Then the second statement waits for the debugger to attach, as it is also noted in the comment. After this line the breakpoint can be inserted anywhere in the method.
If you have tried
If you have tried unsuccessfully to stop the spending train from getting out of control, this might just be the ticket to get you out of the station and down the tracks toward a frugal lifestyle. It works for me, and it's a great repeatable exercise.
Floor Tape
Apparently, this is something
Apparently, this is something interesting to watch. A work of art That is really interesting to Observe. I will from be watching.
how to make out
i like this sites.
Nice article. It really helped me when I was setting up the transactional replication.
Drunk Driving Attorney
This has really made me think
This has really made me think about it, and I have come to the conclusion that you hit the nail on the head so to speak. Your ideas are interesting and makes one think. California DUI Lawyer
affiliate marketing sweet of
affiliate marketing sweet of you to get it done really quickly
this is great.....
Nice blog having nice information. some times we ignore this sort of things & also suffer a lot as well.
parduotuve
very nice
Thank you so much. I learned 30 new things about illustrator from this one video. I would also like to add that the video is great since I can skip forward and backwards with the <-- and --> keys. Simple, clear narration are awesome.FHA Loans
This is a fantastic website
This is a fantastic website and I can not recommend you guys enough. Full of useful resource and great layout very easy on the eyes. Please do keep up this great work. Medical Assistant
Precious has gathered eight
Precious has gathered eight nominations for the 41st annual NAACP Image
Business Ideas for Beginners|Travel Tips With Paulkyle|Event Management Services|bench dogs|Travel Guides for Families|Software magazine|Basic Smart Shopping Tips|home decorating ideas|No Junk Food
nice tips....
nice tips ....
hopefully in the near future I can buy hp android ...
aamiin:)
regards
install ubuntu
Android device is sometime
Android device is sometime very challenging when the database admin would like to debug. This required certain expertise in the database maintenance. Irish kilts
Blogs are a great way to
Blogs are a great way to connect strangers, share experience and provide useful information. You have achieved just that. Thanks for the share. used cars for sale
Useful Article
Great article, the tutorial gave me a lot of information. It's very useful
Durham Festival