如何在没有移动网络使用的情况下向自己发送假短信?

Ade*_*emC 5 sms android send

我想在我的应用程序中将某些信息显示为短信.但是SmsManager和BroadcastReciever无法在手机上创建短信和通知.

如何以编程方式向自己发送假短信?任何想法,变通方法或任何研究课程......?

谢谢.

Mer*_*rez 5

概念证明

拨打短信列表

Intent intent = new Intent("android.intent.action.MAIN");
        intent.setComponent(
            new ComponentName("com.android.mms","com.android.mms.ui.ConversationList"));
        startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

阅读短信

cursor c= getContentResolver().query(uri, null, null ,null,null); 
        startManagingCursor(c);
        c.moveToFirst();  

            String body = c.getString(c.getColumnIndexOrThrow("body")).toString();
            String number = c.getString(c.getColumnIndexOrThrow("address")).toString();

        c.close(); 

        Toast.makeText(getApplicationContext(), number, Toast.LENGTH_LONG).show();
Run Code Online (Sandbox Code Playgroud)

写短信

ContentValues values = new ContentValues();
        values.put("address", "SENDER");
        values.put("body", "foo bar");
        getContentResolver().insert(Uri.parse("content://sms/inbox"), values);
Run Code Online (Sandbox Code Playgroud)

表现

<uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
Run Code Online (Sandbox Code Playgroud)

问题之后没有事件,因此android不知道是否有新消息.