package com.eni.android.telefonia.propiedades;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Menu;

public class PropiedadesTelefoniaEjemplo extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
		// 0 = PHONE_TYPE_NONE, 1 = PHONE_TYPE_GSM, 2 = PHONE_TYPE_CDMA, 3 =
		// PHONE_TYPE_SIP
		int phoneType = tm.getPhoneType();
		Log.v(PropiedadesTelefoniaEjemplo.this.getClass()
				.getName(), "phoneType = " + phoneType);
		String imeiCode = tm.getDeviceId();
		Log.v(PropiedadesTelefoniaEjemplo.this.getClass()
				.getName(), "imeiCode = " + imeiCode);
		String phoneNumber = tm.getLine1Number();
		Log.v(PropiedadesTelefoniaEjemplo.this.getClass()
				.getName(), "phoneNumber = " + phoneNumber);
		// 0 = DATA_DISCONNECTED, 1 = DATA_CONNECTING, 2 = DATA_CONNECTED, 3 =
		// DATA_SUSPENDED
		int dataState = tm.getDataState();
		Log.v(PropiedadesTelefoniaEjemplo.this.getClass()
				.getName(), "dataState = " + dataState);
		String operator = tm.getSimOperator();
		Log.v(PropiedadesTelefoniaEjemplo.this.getClass()
				.getName(), "operator = " + operator);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.propiedades_telefonia_ejemplo, menu);
		return true;
	}

}
