如何为我的App android设置默认短信权限?

时间:2019-06-28 04:17:34

标签: android sms call smsmanager

我在AndroidManifest.xmlIntentFilter中添加了权限。在DialerActivity中,我创建了Fragments来管理所有运行良好的SMS,联系人和呼叫日志。

        <activity android:name=".turecaller.DialerActivity">
            <intent-filter>
                <action android:name="android.intent.action.CALL_PRIVILEGED" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="tel" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.DIAL" />

                <data android:scheme="tel" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.DIAL" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="text/plain" />
            </intent-filter>
        </activity>

这是我的SMS广播接收器

<receiver
            android:name=".ServicesPack.SMSBroadCastReceiver"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.BROADCAST_SMS">
            <intent-filter android:priority="998">
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
                <action android:name="android.provider.Telephony.SMS_DELIVER" />
            </intent-filter>
        </receiver>

2 个答案:

答案 0 :(得分:0)

将其添加到 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If DataGridView1.Rows.Count - 1 > 0 Then For i As Integer = 0 To DataGridView1.Rows.Count - 1 Step +1 If DataGridView1.Rows.Count - 1 > 0 Then DataGridView1.Rows.RemoveAt(0) End If Next Else End If End Sub 之外的manifest

<application tag>

答案 1 :(得分:0)

如果是关于OTP的,则要进行SMS检索,您应该使用Google的SMS检索器API,

https://developers.google.com/identity/sms-retriever/overview