This requires android.permission.INTERACT_ACROSS_USERS_FULL

See this issue related to this question

send and receive SMS to confirm mobile phone number

I have unlocked samsung on my device. I am trying to post a code message. But my code doesn't work, so I plugged my device into USB and track what the problem is. I found myself getting this exception

981/? E/DatabaseUtils﹕ Writing exception to parcel
    java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
        at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13175)
        at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2044)
        at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:615)
        at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
        at android.os.Binder.execTransact(Binder.java:388)
        at dalvik.system.NativeStart.run(Native Method)
07-05 00:53:08.676    2411-2981/? W/ActivityManager﹕ Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
07-05 00:53:08.691  22617-22617/com.keepAeye.gps E/code is﹕ 29514 

      

I have added this permission to my manifest file

   <uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"/>
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>

      

But still doesn't work.

What should I do now?

I know there are several posts on this site about this issue, but none of them help me.

UPDATE

Here is my code for sending a message

  private void sendSMS1(String  phoneNumber, String  message)
{
    String  SENT = "SMS_SENT";
    String  DELIVERED = "SMS_DELIVERED";

    PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
            new Intent(SENT), 0);

    PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
            new Intent(DELIVERED), 0);

    //---when the SMS has been sent---
    registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            switch (getResultCode()) {
                case Activity.RESULT_OK:
                    Toast.makeText(getBaseContext(), "SMS sent",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                    Toast.makeText(getBaseContext(), "Generic failure",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_NO_SERVICE:
                    Toast.makeText(getBaseContext(), "No service",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_NULL_PDU:
                    Toast.makeText(getBaseContext(), "Null PDU",
                            Toast.LENGTH_SHORT).show();
                    break;
                case SmsManager.RESULT_ERROR_RADIO_OFF:
                    Toast.makeText(getBaseContext(), "Radio off",
                            Toast.LENGTH_SHORT).show();
                    break;
            }
        }
    }, new IntentFilter(SENT));

    //---when the SMS has been delivered---
    registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            switch (getResultCode()) {
                case Activity.RESULT_OK:
                    Toast.makeText(getBaseContext(), "SMS delivered",
                            Toast.LENGTH_SHORT).show();
                    break;
                case Activity.RESULT_CANCELED:
                    Toast.makeText(getBaseContext(), "SMS not delivered",
                            Toast.LENGTH_SHORT).show();
                    break;
            }
        }
    }, new IntentFilter(DELIVERED));

    SmsManager sms = SmsManager.getDefault();

    sms.sendTextMessage("9501921***", null, "hello", sentPI, deliveredPI);
}

      

It will always be a general failure. I do not know why.

0


source to share


1 answer


To be able to hold INTERACT_ACROSS_USERS

, your app must be signed with a firmware signing key or it must be installed on the system partition.

To be able to hold INTERACT_ACROSS_USERS_FULL

, your app must be signed with the firmware signing key.



Regular applications are not signed with a firmware signing key, as is done for device manufacturers and those who write custom ROMs. Regular applications are not installed on the system partition, as is done for device manufacturers, those who write custom ROMs, and those who root them.

It's not clear why you think the messages you show in your question are relevant to your application. If you are sure they will, you will need to determine what this means for your code that triggers these messages, and then fix that code.

+1


source







All Articles