Q:

getting data from onHandleIntent

Im trying to implement "Fused Location".
And i have a location service that uses onHandleIntent..
my question is this : can I send get the location information latitude, longitude in the main activity from onHandleIntent??? 
Im calling this service from mainactivity.
like this : 
mIntentService = new Intent(this,LocationService.class);
mPendingIntent = PendingIntent.getService(this, 1, mIntentService, 0);

And my Service Location is this : 
public class LocationService extends IntentService {

    private String TAG = this.getClass().getSimpleName();
    public LocationService() {
        super("Fused Location");
    }

    public LocationService(String name) {
        super("Fused Location");
    }

    @Override
    protected void onHandleIntent(Intent intent) {

            Location location = intent.getParcelableExtra(LocationClient.KEY_LOCATION_CHANGED);
            if(location !=null){
                Log.i(TAG, "onHandleIntent " + location.getLatitude() + "," + location.getLongitude());
                NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); 
                Builder noti = new NotificationCompat.Builder(this);
                noti.setContentTitle("Fused Location");
                noti.setContentText(location.getLatitude() + "," + location.getLongitude());
                noti.setSmallIcon(R.drawable.ic_launcher);

                notificationManager.notify(1234, noti.build());

            }

    }

}

A:

Use LocalBroadcastManager.
By the android documentation:
Helper to register for and send broadcasts of Intents to local objects within your process. This is has a number of advantages over sending global broadcasts with sendBroadcast(Intent):
You know that the data you are broadcasting won't leave your app, so don't need to worry about leaking private data.
It is not possible for other applications to send these broadcasts to your app, so you don't need to worry about having security holes they can exploit.
It is more efficient than sending a global broadcast through the system. 

Check these:

http://www.intertech.com/Blog/using-localbroadcastmanager-in-service-to-activity-communications/
how to use LocalBroadcastManager?

