示例#1
0
        // http://www.happygeek.in/programmatically-get-device-imei-in-android


        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            // http://developer.android.com/guide/topics/ui/notifiers/notifications.html

            base.onCreate(savedInstanceState);

            var sv = new ScrollView(this);

            var ll = new LinearLayout(this);

            ll.setOrientation(LinearLayout.VERTICAL);

            sv.addView(ll);


            Button b = new Button(this).WithText("Whats my IMEI?").AtClick(
                delegate
            {
                TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);

                string imei = telephonyManager.getDeviceId();


                this.setTitle(new { imei }.ToString());

                //this.ShowLongToast("IMEI: " + imei);
            }
                );


            ll.addView(b);

            this.setContentView(sv);
        }