Jump to content

PhCyber Tunnel Available!

Get it on Playstore
Download Now!

Ad Space For Rent

Get Your Product up here and let our users see them first when they visit our Forum. We have thousands of page views everyday!
More Info
Info
  • Welcome to PhCyber
  • Explore and Enjoy Browsing!
  • Lots of useful topics
  • Stay active and receive prizes
SuperVegita1

Sms Message Sender Android Java

Recommended Posts

package com.example.sendsms;  

  

import android.os.Bundle;  

import android.app.Activity;  

import android.app.PendingIntent;  

import android.content.Intent;  

import android.telephony.SmsManager;  

import android.view.Menu;  

import android.view.View;  

import android.view.View.OnClickListener;  

import android.widget.Button;  

import android.widget.EditText;  

import android.widget.Toast;  

  

public class MainActivity extends Activity {  

  

    EditText mobileno,message;  

    Button sendsms;  

    @Override  

    protected void onCreate(Bundle savedInstanceState) {  

        super.onCreate(savedInstanceState);  

        setContentView(R.layout.activity_main);  

          

        mobileno=(EditText)findViewById(R.id.editText1);  

        message=(EditText)findViewById(R.id.editText2);  

        sendsms=(Button)findViewById(R.id.button1);  

          

    //Performing action on button click  

        sendsms.setOnClickListener(new OnClickListener() {  

              

            @Override  

            public void onClick(View arg0) {  

                String no=mobileno.getText().toString();  

                String msg=message.getText().toString();  

                  

                //Getting intent and PendingIntent instance  

                Intent intent=new Intent(getApplicationContext(),MainActivity.class);  

                PendingIntent pi=PendingIntent.getActivity(getApplicationContext(), 0, intent,0);  

                  

                //Get the SmsManager instance and call the sendTextMessage method to send message  

                SmsManager sms=SmsManager.getDefault();  

                sms.sendTextMessage(no, null, msg, pi,null);  

                  

                Toast.makeText(getApplicationContext(), "Message Sent successfully!",  

                    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.activity_main, menu);  

        return true;  

    }  

      

}  

 

//Android manifest Permission

 

 //   <uses-permission android:name="android.permission.SEND_SMS"/>  

    

  //  <uses-permission android:name="android.permission.RECEIVE_SMS"/>  

 

//Automatic Send Message Or Automatic nakaw load code Pm me

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...