package com.samples.locationproviders;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;

public class LocationProvidersActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        final TextView text = (TextView)this.findViewById(R.id.text);
        
		LocationManager manager = (LocationManager)getSystemService(
				  Context.LOCATION_SERVICE);
		text.append("List of Location providers\n");
		
		List<String> providers = manager.getAllProviders();
		for (int i = 0; i < providers.size(); i++) {
			String provider = providers.get(i);
			text.append("\nProvider: " + provider);
			text.append("\nEnabled: " + 
					manager.isProviderEnabled(provider) + "\n");
		}
    }
}