Android Would Like Your Attention
- Determine the port number your emulator is using. This appears in
the title bar of the emulator window, to the left of the colon. A
typical value is 5554.
- From a command prompt, run telnet localhost 5554 (substituting
in your port number for 5554 ). This will open a telnet prompt on
your emulator.
- Type power capacity NN, where NN is the battery charge level you
want the emulator to emulate (e.g., 30 for 30%) and press
- When you are done with the telnet session, type quit and press
Extra Credit...............................................................................................
Here are some things you can try beyond those step-by-step instructions:
- Offer a user preference whereby PostMonitor will only poll if there is
a WiFi connection available. Then, monitor the WiFi connection
state and enable/disable polling as appropriate.
- Offer a user preference whereby PostMonitor will start collecting
timeline updates on boot and will buffer some number of updates,
so when Patchy connects, updates are available immediately and
fewer are missed in between Patchy runs.
Further Reading........................................................................................
Additional coverage of Android-generated broadcast Intent objects can be
found in the "Handling System Events" chapter of The Busy Coder's Guide
to Advanced Android Development.