Hi all, I had a similar issue. What I wanted to do was to run a short service on boot up and initialize a few items and then stop the service. I understand that its not a good idea to leave the service running for the entire life-cycle of the phone. I was able to achieve this by creating a broadcast receiver and starting my service (and do some post delay items). I still need to figure out how to stop the service part. Please chime in if any one has any comments on this.
I also wanted to start the same service once the package was installed. I tried using the PACKAGE_ADDED, PACKAGE_CHANGED intents but I guess the newly installed package does not receive these intents. Can any one point to another strategy for starting up my service after my package installation? An alternative would be to "force phone re-boot" after the package is installed (obviously after giving the choice to the user if he wants to continue or not) but I dont know how to force that either. Any ideas how to achieve that? Thanks for the help in advance Nick On Nov 23, 11:11 pm, Ash <[email protected]> wrote: > At last I could find and fix the problem. > > The problem was after installing my package through ADT plug-in from > Eclipse, for testing BOOT_COMPLETED event I had to restart the > emulator every time, and when I run it again from Eclipse, my package > receives the BOOT_COMPLETED event and starts running, but in between > the Eclipse(ADT) tries to install the package again, which terminates > my service/process. > After installation when I run the emulator from outside the Eclipse, > it works great. > > It was a silly problem to be discussed and happened because of my > novelty in using Eclipse with ADT. > The good thing is that I learned a lot of new concepts and APIs in the > process of fixing this problem. > > Thanks Everyone!! > Ash > > On Nov 23, 7:19 pm, Ash <[email protected]> wrote: > > > Hi!! > > > First of all I am extremely sorry for not providing the logs. (Kindly > > the find the logs below) > > > Let me provide some more information about the service. Initially my > > test environment was full build, when I could successfully test the > > functionality I switched to SDK. > > The same software without a single line change works successfully > > without process killing/service crashing etc. > > > I tried starting the service in a new thread as suggested but that > > didn’t help. Also my service is not getting restarted. > > > I could not observe/find any Low Memory, ANR or Service crashing > > traces, though one of the trace says > > > “Scheduling restart of crashed service > > com.mycompany.voip/.service.VoIPManager in 5000ms” > > > Surprisingly, my service did not get killed and was alive life-long > > after I removed one of the permission “ACCESS_CHECKIN_PROPERTIES” > > from AndroidManifest.xml but that is not the real fix because with > > this fix I could not run it successfully next time. > > > I am now clueless about the crash. Kindly provide some directions. > > > Thanks in advance > > Ash > > > Package Name: com.mycompany.voip > > > Logcat –b event: > > --------------------------------------------------------------------------------------------------- > > I/boot_progress_start( 553): 4455 > > I/boot_progress_preload_start( 553): 5701 > > I/dvm_gc_info( 553): > > [8825198673194435749,-9065622874527238670,-4134462757533256206,0] > > I/dvm_gc_info( 553): > > [8825198673194411075,-9144998817959537112,-4131929482742753752,0] > > I/dvm_gc_info( 553): > > [8825198673194419250,-9164702066329053645,-4128833257998707149,0] > > I/dvm_gc_info( 553): > > [8825198673194427506,-9093207422244374979,-4126018508231428547,0] > > I/dvm_gc_info( 553): > > [8825198673194489386,-9016083278087436653,-4101811659696093549,0] > > I/dvm_gc_info( 553): > > [8825198673194550882,-8922632417303152977,-4093929191831849297,0] > > I/dvm_gc_info( 553): > > [8825198673194567275,-8923474642673121594,-4087453067807340858,0] > > I/dvm_gc_info( 553): > > [8825198673194583664,-8922909493427964195,-4080976944051259683,0] > > I/dvm_gc_info( 553): > > [8825198673194612348,-8919249218950650139,-4078724044457498907,0] > > I/dvm_gc_info( 553): > > [8825198673194612342,-8922625818891073797,-4072530495189760261,0] > > I/dvm_gc_info( 553): > > [8825198673194575421,-8974698689314085113,-4069152795200772345,0] > > I/dvm_gc_info( 553): > > [8825198673194542225,-9125005227097495779,-4062959245933058275,0] > > I/dvm_gc_info( 553): > > [8825198673194583229,-9065332530692524189,-4043255996220999837,0] > > I/dvm_gc_info( 553): > > [8825198673194591378,-9132886525103077527,-4041567146360731799,0] > > I/dvm_gc_info( 553): > > [8825198673194583156,-9088976428736206993,-4039878296500459665,0] > > I/dvm_gc_info( 553): > > [8825198673194595430,-9099109527109257353,-4037626495898241161,0] > > I/dvm_gc_info( 553): > > [8825198673194587298,-9080812554111428739,-4035936546526341251,0] > > I/dvm_gc_info( 553): > > [8825198673194603672,-9069553555026221182,-4026084922324686974,0] > > I/dvm_gc_info( 553): > > [8825198673194595416,-9126973350763554931,-4025802347836336243,0] > > I/dvm_gc_info( 553): > > [8825198673194615881,-9128099250653595752,-4025802347819534440,0] > > I/dvm_gc_info( 553): > > [8825198673194611838,-9068143981102590050,-4025519773331187810,0] > > I/dvm_gc_info( 553): > > [8825198673194735225,-8919235953104992345,-4025512008013527129,0] > > I/dvm_gc_info( 553): > > [8825198673194976883,-8922613584089225282,-4024948989323810882,0] > > I/dvm_gc_info( 553): > > [8825198673194714700,-8953575762791110703,-4024667445610813487,0] > > I/dvm_gc_info( 553): > > [8825198673194648745,-9065884278481877031,-4024385970617317415,0] > > I/dvm_gc_info( 553): > > [8825198673194660987,-9068699028248975393,-4024385970617309217,0] > > I/dvm_gc_info( 553): > > [8825198673194652775,-9106979625064843289,-4024385970600527897,0] > > I/dvm_gc_info( 553): > > [8825198673194665038,-9135127122350028817,-4017630570773592081,0] > > I/dvm_gc_info( 553): > > [8825198673194652716,-9208029141318088724,-4017630570773592084,0] > > I/dvm_gc_info( 553): > > [8825198673194939451,-9128371722875402249,-4015660245903046665,6825561] > > I/dvm_gc_info( 553): > > [8825198673194660910,-9144415796547901442,-4014815820972906498,6825600] > > I/boot_progress_preload_end( 553): 17087 > > I/dvm_gc_info( 553): > > [8825198673194689569,-9190296217751738369,-4014534345996195841,7370389] > > I/dvm_gc_info( 553): > > [8825198673194660859,-9165526419801204739,-4014534345996199939,7370389] > > I/dvm_gc_info( 553): > > [8825198673194676824,-9213095690865305603,-4014534345996199939,7370389] > > I/boot_progress_system_run( 587): 17917 > > I/boot_progress_pms_start( 587): 18289 > > I/boot_progress_pms_system_scan_start( 587): 18784 > > I/dvm_gc_info( 587): > > [8320808730292176444,-8974404086165411804,-4017630296264763395,7370389] > > I/dvm_gc_info( 587): > > [8320808730292123191,-9014936139130365911,-4016222921381210117,7370389] > > I/boot_progress_pms_data_scan_start( 587): 20686 > > I/boot_progress_pms_scan_end( 587): 20731 > > I/boot_progress_pms_ready( 587): 20858 > > I/dvm_gc_info( 587): > > [8320808730292078120,-9028165394316310487,-4016222921381210117,7370389] > > I/battery_status( 587): [2,2,1,1,Li-ion] > > I/battery_level( 587): [50,0,0] > > I/power_screen_state( 587): [1,0,0,0] > > I/power_screen_broadcast_send( 587): 1 > > I/free_storage_left( 587): 44625920 > > I/free_storage_changed( 587): 44625920 > > I/configuration_changed( 587): 248 > > I/screen_toggled( 587): 1 > > I/dvm_gc_info( 587): > > [8320808730292151861,-9017469070256199634,-4014534071520946181,7370415] > > I/boot_progress_ams_ready( 587): 23434 > > I/am_proc_start( 587): [631,1001,com.android.phone,added > > application,com.android.phone] > > I/am_create_task( 587): 2 > > I/am_create_activity( 587): > > [1130981976,2,com.android.launcher/.Launcher,android.intent.action.MAIN,,, > > 268435456] > > I/am_proc_start( 587): > > [633,10003,android.process.acore,activity,com.android.launcher/.Launcher] > > I/dvm_gc_madvise_info( 631): [364544,122880] > > I/dvm_gc_madvise_info( 633): [364544,122880] > > I/am_proc_bound( 587): [631,com.android.phone] > > I/am_proc_bound( 587): [633,android.process.acore] > > I/am_restart_activity( 587): > > [1130981976,2,com.android.launcher/.Launcher] > > I/power_screen_broadcast_done( 587): [1,3496,1] > > I/watchdog_pss_stats( 587): [0,0,0,0,0,0,0,0,3570688,1,0] > > I/watchdog_proc_stats( 587): [0,0,0,0,0] > > I/watchdog_meminfo( 587): > > [27586560,12288,46411776,30789632,32129024,16523264,21413888,2736128,786432,1949696,1437696] > > I/watchdog_vmstat( 587): [26349,29835,3485,0,26088,439] > > I/dvm_gc_madvise_info( 587): [372736,315392] > > I/notification_cancel( 587): [com.android.phone,2,0] > > I/am_proc_start( 587): > > [660,10015,com.android.mms,broadcast,com.android.mms/.transaction.SmsReceiver] > > I/dvm_gc_madvise_info( 660): [364544,122880] > > I/am_proc_bound( 587): [660,com.android.mms] > > I/dvm_gc_info( 633): > > [7017575181486765616,-9027039975529797596,-4017067346311337952,7370422] > > I/am_create_service( 587): > > [1131278824,com.android.mms/.transaction.SmsReceiverService,Intent > > { action=android.intent.action.SERVICE_STATE comp={com.android.mms/ > > com.android.mms.transaction.SmsReceiverService} },660] > > I/am_on_resume_called( 633): com.android.launcher.Launcher > > I/am_destroy_service( 587): > > [1131278824,com.android.mms/.transaction.SmsReceiverService,660] > > I/boot_progress_enable_screen( 587): 32570 > > I/activity_launch_time( 587): > > [1130981976,com.android.launcher/.Launcher,8830] > > I/dvm_gc_info( 587): > > [8320808730293847627,-8963425599749142479,-4009186046963443717,8148871] > > I/am_proc_start( 587): > > [680,10000,com.android.alarmclock,broadcast,com.android.alarmclock/.AlarmInitReceiver] > > I/dvm_gc_madvise_info( 680): [364544,122880] > > I/am_proc_bound( 587): [680,com.android.alarmclock] > > I/am_proc_start( 587): > > [692,10004,android.process.media,broadcast,com.android.providers.downloads/.DownloadReceiver] > > I/dvm_gc_madvise_info( 692): [360448,122880] > > I/dvm_gc_madvise_info( 633): [323584,303104] > > I/am_proc_bound( 587): [692,android.process.media] > > I/am_create_service( 587): > > [1131239184,com.android.providers.downloads/.DownloadService,Intent > > { comp={com.android.providers.downloads/ > > com.android.providers.downloads.DownloadService} },692] > > I/notification_cancel_all( 587): [com.android.providers.downloads,0] > > I/am_create_service( 587): > > [1131105568,com.android.providers.media/.MediaScannerService,Intent > > { comp={com.android.providers.media/ > > com.android.providers.media.MediaScannerService} },692] > > I/notification_cancel( 587): [com.android.mms,123,0] > > I/am_create_service( 587): > > [1130197456,com.android.mms/.transaction.SmsReceiverService,Intent > > { action=android.intent.action.BOOT_COMPLETED comp={com.android.mms/ > > com.android.mms.transaction.SmsReceiverService} },660] > > I/am_proc_start( 587): > > ... > > read more » -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

