//package uk.me.kjs.android.helloworld;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.telephony.*;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class Init extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String str = new String();
String net = new String();
switch(tm.getNetworkType())
{
case TelephonyManager.NETWORK_TYPE_1xRTT:
net = "CDMA - 2000";
break;
case TelephonyManager.NETWORK_TYPE_CDMA:
net = "CDMA";
break;
case TelephonyManager.NETWORK_TYPE_EDGE:
net = "GSM - EDGE";
break;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
net = "CDMA - EVDO A";
break;
case TelephonyManager.NETWORK_TYPE_EVDO_A:
net = "CDMA - EVDO A";
break;
case TelephonyManager.NETWORK_TYPE_GPRS:
net = "GSM - GPRS";
break;
case TelephonyManager.NETWORK_TYPE_UMTS:
net = "UMTS";
break;
case 8:
net = "UMTS - HSDPA ";
break;
case 9:
net = "UMTS - HSUPA ";
break;
case 10:
net = "UMTS - HSPA ";
break;
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
default:
net = "Unknown";
}
String home = new String();
if ( tm.isNetworkRoaming() == true)
{
home = "Roaming";
}
else
{
home = "Home";
}
str = "SIM Information";
str += "\nName : " + tm.getSimOperatorName();
str += "\nCode : " + tm.getSimOperator() + " (" + tm.getSimCountryIso() + ")";
str += "\n";
str += "\nConnected Network";
str += "\nName : " + tm.getNetworkOperatorName();
str += "\nRoaming : " + home;
str += "\nCode : " + tm.getNetworkOperator() + " (" + tm.getNetworkCountryIso() + ")";
str += "\nType : " + net;
tv.setTextSize(20);
tv.setText(str);
setContentView(tv);
Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
}