package com.eni.android.telephonie.propriete;

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

public class Ch14_ProprietesTelephonieExempleActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public 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(Ch14_ProprietesTelephonieExempleActivity.this.getClass()
				.getName(), "phoneType = " + phoneType);
		String imeiCode = tm.getDeviceId();
		Log.v(Ch14_ProprietesTelephonieExempleActivity.this.getClass()
				.getName(), "imeiCode = " + imeiCode);
		String phoneNumber = tm.getLine1Number();
		Log.v(Ch14_ProprietesTelephonieExempleActivity.this.getClass()
				.getName(), "phoneNumber = " + phoneNumber);
		// 0 = DATA_DISCONNECTED, 1 = DATA_CONNECTING, 2 = DATA_CONNECTED, 3 =
		// DATA_SUSPENDED
		int dataState = tm.getDataState();
		Log.v(Ch14_ProprietesTelephonieExempleActivity.this.getClass()
				.getName(), "dataState = " + dataState);
		String operator = tm.getSimOperator();
		Log.v(Ch14_ProprietesTelephonieExempleActivity.this.getClass()
				.getName(), "operator = " + operator);
	}
}