Android 如何在棒棒糖上伪造短信?

Android 如何在棒棒糖上伪造短信?,android,sms,android-5.0-lollipop,Android,Sms,Android 5.0 Lollipop,这是我代码的一部分,但我不明白为什么它不起作用。我在清单中也设置了正确的权限 enum Box { Inbox, Sent } void AddMessage(String Address, String Message, Time Sent, Box b, boolean read) { Uri u = null; switch (b) { case Inbox: u = Uri.parse("content://s

这是我代码的一部分,但我不明白为什么它不起作用。我在清单中也设置了正确的权限

enum Box
{
    Inbox, Sent
}

void AddMessage(String Address, String Message, Time Sent, Box b,
        boolean read)
{

    Uri u = null;

    switch (b)
    {
    case Inbox:
        u = Uri.parse("content://sms/inbox");
        break;
    case Sent:
        u = Uri.parse("content://sms/sent");
        break;
    }

    if (u != null)
    {
        Cursor mCursor = this.getContentResolver().query(u, null, null,
                null, null);

        ContentProviderClient P = this.getContentResolver()
                .acquireContentProviderClient(u);

        ContentValues v = new ContentValues();
        v.put("body", Message);
        v.put("read", read);
        v.put("seen", true);
        v.put("address", Address);
        v.put("date", Sent.toMillis(false));
        v.put("date_sent", Sent.toMillis(false));

        try
        {
            int Thread = -1;
            Uri InsertedMessage = P.insert(u, v);
            Log.d("InsertedURI", InsertedMessage.toString());
            Cursor InsertedMessageCursor = this.getContentResolver().query(
                    InsertedMessage, null, null, null, null);
            getContentResolver().insert(Uri.parse("content://sms/"), v);
            if (InsertedMessageCursor.moveToFirst())
            {
                Thread = InsertedMessageCursor.getInt(InsertedMessageCursor
                        .getColumnIndex("thread_id"));
                Uri MessageThread = Uri.parse("content://mms-sms/threadID/"
                        + Thread);
                Log.d("MessageThread", MessageThread.toString());
                Intent V = new Intent(Intent.ACTION_VIEW);
                V.setData(MessageThread);
                this.startActivity(V);
            }

        } catch (RemoteException e)
        {

            e.printStackTrace();
        }

    }

}

void processIntent(Intent intent)
{
    if (intent == null)
        return;

    if (Intent.ACTION_SENDTO.equals(intent.getAction()))
    {
        String destionationNumber = intent.getDataString();
        destionationNumber = URLDecoder.decode(destionationNumber);
        // clear the string
        destionationNumber = destionationNumber// .replace("-", "")
                .replace("smsto:", "").replace("sms:", "");
        editText_ToFrom.setText(destionationNumber);
    }

}
我的问题是,它没有把我的短信列表短信。我想实现这样的目标:
提前谢谢你

您收到的错误消息是什么?贴上stacktraceOkay,所以我想,它确实有效,但不是在棒棒糖上。棒棒糖需要特殊许可吗?或者API部分已经更改,我也需要更改?