APK Develop——SMS Timer

SMS Timer APK 描述:

  在设定时间后向设定手机号码发送设定的内容的短信。

 

权限获取:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.chenh2.hellohao" >
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ChooseActivity"
            android:label="@string/title_activity_choose" >
        </activity>
    </application>
    <uses-permission  android:name="android.permission.SEND_SMS"/>
</manifest>

Activity 跳转及数据传输:

Intent chooseIntent = new Intent(MainActivity.this,ChooseActivity.class);//Activity跳转
        Bundle bundle = new Bundle();
        bundle.putString("Phone", num);
        bundle.putString("SmsM", mes);
        chooseIntent.putExtras(bundle);   //数据传输
        phone.setText("");
        sms.setText("");
        time.setText("");
        if(PhoneNumberUtils.isGlobalPhoneNumber(num)){
            Uri uri = Uri.parse("smsto:" + num);
            Intent it = new Intent(Intent.ACTION_SENDTO, uri);
            it.putExtra("sms_body", mes);
            try {
                int n =Integer.parseInt(minu);
                if(n>0){
                    while(n>0){
                        Thread.sleep(1000);
                        System.out.println(n);
                        n--;
                    }
                }
            } catch (InterruptedException e) {

                e.printStackTrace();
            }
            if(remind.isChecked()){
                startActivity(chooseIntent);       //Activity跳转
            }
            else{
                SmsManager smsManager = SmsManager.getDefault();
                List<String> divideContents = smsManager.divideMessage(mes);
                for (String text : divideContents) {
                    smsManager.sendTextMessage(num, null, text, null, null);//短信发送
                }
                return;
            }
public class ChooseActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose);
        Button yes = (Button)findViewById(R.id.Yes);
        yes.setOnClickListener(new Button.OnClickListener(){
            public void onClick(View v) {

                SmsManager smsManager = SmsManager.getDefault();
                List<String> divideContents = smsManager.divideMessage(getIntent().getExtras().getString("SmsM"));//数据获取
                for (String text : divideContents) {
                    smsManager.sendTextMessage(getIntent().getExtras().getString("Phone"), null, text, null, null);
                }
                finish();
            }
        });
        Button no = (Button)findViewById(R.id.No);
        no.setOnClickListener(new Button.OnClickListener(){
            public void onClick(View v) {
                finish();
            }
        });
    }

 APK下载链接:

https://files.cnblogs.com/files/udld/app-release.apk

posted @ 2015-03-02 15:44  UDLD  阅读(263)  评论(0编辑  收藏  举报