1

Does someone know how to simulate service crash in emulator ? I have two services running in my application on Emulator, and I have to check what happens if a Service crashes..

Thanks in Advance

Name is Nilay
  • 2,653
  • 4
  • 29
  • 75
  • Releated: http://stackoverflow.com/questions/7257378/android-how-to-force-restart-service-os-killing-on-low-memory-behavior – Flow Sep 05 '13 at 10:22

2 Answers2

1

If you want to make the service crash, all you need to do is to make it throw unhandled exception. If you write: int a = 3/0 it will throw an exception, and the service will crash

RE6
  • 2,524
  • 3
  • 28
  • 53
0

You can also stop service in Settings-Application-Running and choose your App/Service. This is not exactly crash, but stopping service during some work can cause also some troubles ;-)

Warlock
  • 2,056
  • 4
  • 26
  • 42