title: Send imsi and imei number as sms in android
body: <p>I have to send imsi and imei number of my mobile to some other number as sms. Now i am able to get the imsi and imei of my mobile using the below code</p>
  
  <pre><code>package com.example.phonenumber;
  
  import android.app.Activity;
  import android.content.Context;
  import android.os.Bundle;
  import android.telephony.TelephonyManager;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      //Getting the Object of TelephonyManager 
  TelephonyManager tManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
  
  
      String Imei=tManager.getDeviceId();
      String Imsi=tManager.getSubscriberId();
  
      TextView i=(TextView)findViewById(R.id.imeino);//Getting the TextView to display IMEI number
      i.setText("IMEI number - "+Imei);//Displaying IMEI number
  
      TextView n=(TextView)findViewById(R.id.imsi);
      n.setText("IMSI number - "+Imsi);
  }
   }
  </code></pre>
  
  <p>And for sending sms the code is</p>
  
  <pre><code>package com.example.sms;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.telephony.SmsManager;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  import android.widget.Toast;
  
  
  public class MainActivity extends ActionBarActivity {
  
  Button button;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      button = (Button) findViewById(R.id.buttonSend);
  
  
      button.setOnClickListener(new View.OnClickListener(){
          public void onClick(View v) {
  
  
              String phoneNo = "123456";
              SmsManager smsManager = SmsManager.getDefault();
              smsManager.sendTextMessage(phoneNo, null, "Txt msg successfull", null, null);
              Toast.makeText(getApplicationContext(), "SMS Sent!",
                          Toast.LENGTH_LONG).show();
  
  
          }
      });
  
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
      if (id == R.id.action_settings) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  }
  </code></pre>
  
  <p>Now how can i integrate these two codes? I should send sms the imsi and imei to 123456 or some xxxx number directly. Please suggest me a solution.</p>