I got nowhere with my previous question, so I did some experimenting and am trying again. The following code is correct AFAIK, but reliably crashes the emulator with a SIGSEGV. The build target is 2.3.1.
public class LocationUpdateDemoActivity extends Activity { private static final String NEW_SINGLE = "com.androidbook.location.NEW_SINGLE"; LocationManager locMgr = null; private BroadcastReceiver receiver; private PendingIntent pIntent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); locMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE); } @Override public void onResume() { super.onResume(); pIntent = PendingIntent.getBroadcast(this, 0, new Intent(NEW_SINGLE), PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter iFilter = new IntentFilter(NEW_SINGLE); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.v("receiver", "Got intent: " + intent.getAction()); } }; this.registerReceiver(receiver, iFilter); locMgr.requestSingleUpdate( LocationManager.GPS_PROVIDER, pIntent); } @Override public void onPause() { super.onPause(); locMgr.removeUpdates(pIntent); this.unregisterReceiver(receiver); } } The app starts up okay, displaying a black screen with the proper title. I then go to the Emulator Control panel in DDMS and click the Send button for the default GPS coordinates. LogCat then reports the following, after which all apps die and the emulator starts to reboot (it gets stuck restarting): 01-31 02:17:08.579: INFO/DEBUG(31): Build fingerprint: 'generic/sdk/ generic:2.3.1/GSI11/93351:eng/test-keys' 01-31 02:17:08.604: INFO/DEBUG(31): pid: 75, tid: 209 >>> system_server <<< 01-31 02:17:08.626: INFO/DEBUG(31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000 01-31 02:17:08.640: INFO/DEBUG(31): r0 00000000 r1 407a3b20 r2 41adfcbc r3 46528c74 01-31 02:17:08.650: INFO/DEBUG(31): r4 0000012d r5 00000000 r6 407a3b20 r7 41adfcbc 01-31 02:17:08.650: INFO/DEBUG(31): r8 84301321 r9 84302240 10 00100000 fp 00000001 01-31 02:17:08.669: INFO/DEBUG(31): ip 82f0e7d4 sp 46528c60 lr 82f0ab37 pc 82f07d0e cpsr 00000030 01-31 02:17:09.630: INFO/DEBUG(31): #00 pc 00007d0e /system/ lib/libandroid_servers.so 01-31 02:17:09.630: INFO/DEBUG(31): #01 pc 0000ab32 /system/ lib/libandroid_servers.so 01-31 02:17:09.660: INFO/DEBUG(31): #02 pc 000012ca /system/ lib/hw/gps.goldfish.so 01-31 02:17:09.692: INFO/DEBUG(31): #03 pc 000014ae /system/ lib/hw/gps.goldfish.so 01-31 02:17:09.692: INFO/DEBUG(31): #04 pc 00011a7c /system/ lib/libc.so 01-31 02:17:09.720: INFO/DEBUG(31): #05 pc 00011640 /system/ lib/libc.so 01-31 02:17:09.730: INFO/DEBUG(31): code around pc: 01-31 02:17:09.751: INFO/DEBUG(31): 82f07cec ab04b082 9301cb04 6f646804 b00247a0 01-31 02:17:09.751: INFO/DEBUG(31): 82f07cfc bc08bc10 4718b002 b510b40c ab04b082 01-31 02:17:09.751: INFO/DEBUG(31): 82f07d0c 6804cb04 34f89301 47a06824 bc10b002 01-31 02:17:09.751: INFO/DEBUG(31): 82f07d1c b002bc08 46c04718 b510b40c ab04b082 01-31 02:17:09.751: INFO/DEBUG(31): 82f07d2c 9301cb04 34986804 47a06824 bc10b002 01-31 02:17:09.792: INFO/DEBUG(31): code around lr: 01-31 02:17:09.792: INFO/DEBUG(31): 82f0ab14 91099008 f7fb6aa0 900aeb14 1c3a910b 01-31 02:17:09.792: INFO/DEBUG(31): 82f0ab24 6b646b23 930c1c28 1c31940d f7fd9b0f 01-31 02:17:09.792: INFO/DEBUG(31): 82f0ab34 4906f8e7 44791c28 f7ff3150 b011fe1d 01-31 02:17:09.792: INFO/DEBUG(31): 82f0ab44 46c0bdf0 0000454c 000042c8 00000786 01-31 02:17:09.792: INFO/DEBUG(31): 82f0ab54 f7fbb510 bd10ec7c 4802b510 f7fb4478 01-31 02:17:09.792: INFO/DEBUG(31): stack: 01-31 02:17:09.792: INFO/DEBUG(31): 46528c20 d97f62b7 01-31 02:17:09.792: INFO/DEBUG(31): 46528c24 40c7d685 01-31 02:17:09.792: INFO/DEBUG(31): 46528c28 0000000a 01-31 02:17:09.799: INFO/DEBUG(31): 46528c2c 00000000 01-31 02:17:09.799: INFO/DEBUG(31): 46528c30 0000ab90 [heap] 01-31 02:17:09.799: INFO/DEBUG(31): 46528c34 81d48bd3 /system/ lib/libdvm.so 01-31 02:17:09.799: INFO/DEBUG(31): 46528c38 0000ab90 [heap] 01-31 02:17:09.799: INFO/DEBUG(31): 46528c3c 46528c6c 01-31 02:17:09.799: INFO/DEBUG(31): 46528c40 00010004 [heap] 01-31 02:17:09.809: INFO/DEBUG(31): 46528c44 81d3761b /system/ lib/libdvm.so 01-31 02:17:09.809: INFO/DEBUG(31): 46528c48 00000000 01-31 02:17:09.809: INFO/DEBUG(31): 46528c4c afd0dcc4 /system/ lib/libc.so 01-31 02:17:09.809: INFO/DEBUG(31): 46528c50 00000000 01-31 02:17:09.809: INFO/DEBUG(31): 46528c54 46528e00 01-31 02:17:09.809: INFO/DEBUG(31): 46528c58 df002777 01-31 02:17:09.809: INFO/DEBUG(31): 46528c5c e3a070ad 01-31 02:17:09.809: INFO/DEBUG(31): #00 46528c60 00000001 01-31 02:17:09.809: INFO/DEBUG(31): 46528c64 8053bf25 /system/ lib/libandroid_runtime.so 01-31 02:17:09.809: INFO/DEBUG(31): 46528c68 0000012d 01-31 02:17:09.860: INFO/DEBUG(31): 46528c6c 82f0ab37 /system/ lib/libandroid_servers.so 01-31 02:17:09.860: INFO/DEBUG(31): 46528c70 41adfcbc /dev/ ashmem/dalvik-LinearAlloc (deleted) 01-31 02:17:09.860: INFO/DEBUG(31): 46528c74 00000003 01-31 02:17:09.891: INFO/DEBUG(31): #01 46528c78 4284dfce /data/ dalvik-cache/system@framew...@framework.jar@classes.dex 01-31 02:17:09.891: INFO/DEBUG(31): 46528c7c 4042b604 /dev/ ashmem/dalvik-heap (deleted) 01-31 02:17:09.891: INFO/DEBUG(31): 46528c80 cffeb075 01-31 02:17:09.891: INFO/DEBUG(31): 46528c84 c05e8561 01-31 02:17:09.891: INFO/DEBUG(31): 46528c88 00000000 01-31 02:17:09.891: INFO/DEBUG(31): 46528c8c 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528c90 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528c94 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528c98 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528c9c 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528ca0 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528ca4 00000000 01-31 02:17:09.939: INFO/DEBUG(31): 46528ca8 d95e6c00 01-31 02:17:09.969: INFO/DEBUG(31): 46528cac 0000012d 01-31 02:17:09.969: INFO/DEBUG(31): 46528cb0 46528e56 01-31 02:17:09.969: INFO/DEBUG(31): 46528cb4 00000003 01-31 02:17:09.969: INFO/DEBUG(31): 46528cb8 0000000a 01-31 02:17:09.969: INFO/DEBUG(31): 46528cbc 46528de8 01-31 02:17:09.969: INFO/DEBUG(31): 46528cc0 00000000 01-31 02:17:09.969: INFO/DEBUG(31): 46528cc4 46528e6c 01-31 02:17:09.969: INFO/DEBUG(31): 46528cc8 00000001 01-31 02:17:10.000: INFO/DEBUG(31): 46528ccc 843012cd /system/ lib/hw/gps.goldfish.so 01-31 02:17:43.249: DEBUG/Zygote(33): Process 75 terminated by signal (11) 01-31 02:17:43.249: INFO/Zygote(33): Exit zygote because system server (75) has terminated 01-31 02:17:43.340: INFO/ServiceManager(28): service 'usagestats' died 01-31 02:17:43.340: INFO/ServiceManager(28): service 'audio' died Any ideas here? The documentation on this method appears to be completely unrelated to what I would expect, and what I'm actually seeing. My guess is that the GPS data is supposed to be added to the Intent in extras, but this isn't clear from the description. It the location or status information is being added as data, then my intent filter won't match and maybe the device dies because of that disconnect. Help please? - dave On Dec 26 2010, 3:31 am, farble1670 <jeffrey.blatt...@gmail.com> wrote: > don't have the answer, but wondering this myself. my guess is the same > as yours ... the docs must be incorrect. > > On Dec 7, 9:02 pm, davemac <davemac...@gmail.com> wrote: > > > This is a new method in Android 2.3's LocationManager. It says > > basically the same thing as what it says for requestLocationUpdates(), > > except that there's no way to specify a minTime or minDistance. From > > the name I would guess that my listener is going to be called once and > > that's it, maybe as soon as a reliable location is available. But the > > descriptions start with this: > > > Registers the current activity to be notified periodically by the > > named provider. Periodically, the supplied LocationListener will be > > called with the current Location or with status updates. > > > "Periodically" is not defined nor settable it seems. And why would > > this method be calledrequestSingleUpdateif it gets multiple updates? > > Does anyone know how to use these methods? > > > Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en