help about SMS BroadcastReceiver conflict with GPS LOCATION_SERVICE

by Kevin AN » Mon, 02 Mar 2009 11:24:49 GMT


Sponsored Links
 code is here:
public void onReceive(Context context, Intent intent)
{
                LocationManager lm = (LocationManager) context.getSystemService
(Context.LOCATION_SERVICE);

                loc = lm.getLastKnownLocation("gps").toString();

                PendingIntent dummyEvent = PendingIntent.getBroadcast(context, 
0,
new Intent("com.xxx.xxx.IGNORE_ME"), 0);
                mng.sendTextMessage(addr, null, loc, dummyEvent, dummyEvent);

}

the problem is:
sendTextMessage work well when the two above line is commented. but
when the two line is uncommented, sendTextMessage will trigger a null
point exception!
I think this issue is because the first line
(context.getSystemService) modify the state of "context".
so , can anyone help me?

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Launch android emulator on mingw/msys, but failed

What does it say if you run it with emulator -verbose or -debug init?
R/




--~--~---------~--~----~------------~-------~--~----~

2. HTC Magic, is PhoneNumberUtils.PAUSE different?

At this point there is no "HTC Magic."  I would assume that these people are
using one of the leaked builds of 1.5, which is from some random pre-final
build of 1.5 with some random set of changes HTC as done on it.  I would not
spend my time trying to support it at this point, as it is not a real
product.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~

3. How To Call Methods Of Activity From A Service

4. 1.5 SDK issue

5. orientation change runtime option?

6. How automatically install a 3rd-party static lib or so in Android.mk

7. ANT Build files sdk 1.5 and beyond