Answer the question
In order to leave comments, you need to log in
How to send SMS to Android API without dialog appearing?
How to send SMS on Android bypassing the send request so that the user does not see the dialog "Send SMS? This may cost you money"? Is this possible in principle on a non-rooted device with Android 5.0+?
Answer the question
In order to leave comments, you need to log in
Regardless of whether you change the default application or not, the dialog for accessing the system function will still be there.
Permission details can be found here .
Try to make the application "Device Administrator".
For a long time I have been making a corporate device control system with the ability to remotely reset passwords and completely clear data through our web interface. The solution was this opportunity.
In AndroidManifest:
<uses-feature
android:name="android.software.device_admin"
android:required="true"/>
<application
.........
<receiver
android:name=".Receiver.AdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_admin"/>
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
<action android:name="android.app.action.ACTION_PASSWORD_CHANGED"/>
<action android:name="android.app.action.ACTION_PASSWORD_FAILED"/>
<action android:name="android.app.action.ACTION_PASSWORD_SUCCEEDED"/>
<action android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<action android:name="android.permission.WRITE_SETTINGS" />
</intent-filter>
</receiver>
import android.app.admin.DeviceAdminReceiver;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class AdminReceiver extends DeviceAdminReceiver {
@Override
public void onEnabled(Context ctxt, Intent intent) {
ComponentName cn=new ComponentName(ctxt, AdminReceiver.class);
DevicePolicyManager mgr=
(DevicePolicyManager)ctxt.getSystemService(Context.DEVICE_POLICY_SERVICE);
mgr.setPasswordQuality(cn,
DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC);
onPasswordChanged(ctxt, intent);
}
@Override
public void onPasswordChanged(Context ctxt, Intent intent) {
DevicePolicyManager mgr=
(DevicePolicyManager)ctxt.getSystemService(Context.DEVICE_POLICY_SERVICE);
String msgId = "";
if (mgr.isActivePasswordSufficient()) {
msgId="Ok";
}
else {
msgId="Fail";
}
Toast.makeText(ctxt, msgId, Toast.LENGTH_LONG).show();
}
@Override
public void onPasswordFailed(Context ctxt, Intent intent) {
}
@Override
public void onPasswordSucceeded(Context ctxt, Intent intent) {
}
}
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<watch-login />
<reset-password />
<force-lock />
<wipe-data />
<expire-password />
<encrypted-storage />
</uses-policies>
</device-admin>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question