Make a call on Android 10

Emerick

i made an app that automatically makes a call if a pre configured code arrives in SMS.

I originally build this app on Android 9 and it worked well as long as i'm using Android 9, but my phone upgraded to Android 10 version and it just stopped working.

Analysing the logs and debuging the app, not a single error message happens. Debuging everything works fines and i call the acctivity as follows:

Intent in = new Intent(Intent.ACTION_CALL);
in.setData(Uri.parse(callPhone));
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(in);

But nothing happens. Its just doesnt make the call. I installed in other devices using other versions of android and still works, but not in Android 10.

Anyone knows if something different was implemented or if theres a new way to make a call on Android 10 version?

*NOTE: I also tried to update the code to use androidx library as changed to use targetSdkVersion 29, but still the same.

Eren Tüfekçi

Android 10 restricted to starting activity from background. There are some exclusions for this. In my view asking for "SYSTEM_ALERT_WINDOW" permission is the easiest one. Hope it helps.

https://developer.android.com/guide/components/activities/background-starts

https://stackoverflow.com/a/59421118/11982611

In manifest :

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

Somewhere in your code

private void RequestPermission() {
            // Check if Android M or higher
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                // Show alert dialog to the user saying a separate permission is needed
                // Launch the settings activity if the user prefers
                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                        Uri.parse("package:" + getActivity().getPackageName()));
                startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
            }
        }

    @Override
    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                if (!Settings.canDrawOverlays(getContext())) {
                    PermissionDenied();
                }
                else
                {
                 //Permission Granted-System will work
            }

        }
    }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Make a call using action_call intent on Android 10 doesn't work

Make a call in android

android-make whatsapp call

android livedata make sequential call

How to make a call programmatically in android

How to make a call for 10 digit number in FreeSwitch?

Get incoming call number programmatically on android 10

Android / Blackberry10 call information not appearing

android make call from app hide number

Not able to make call using Intent Android

How to make a phone call using intent in Android?

Failing to make call to API from android client

Make a call in android that does not have an activity

How to make a special call and get result in android?

Trying to make an android app call a number

How to make incoming call in Genymotion emulator for Android?

Make call OnItem click in android using columnIndex

Make Call in Android Application using default call application

How to make HTTP call with action=PATCH using CFHTTP ( ColdFusion 10 )

How to open activity (incoming voip call) in Android 10

How to make call to my mobile number in Android sip stack SipManager?

Xamarin.forms make phone call without going to dialer in Android

Make a call synchronously with loopj Android Asynchronous Http Client

How to write a phone number for calling in android but not make the call

Make sure to call FirebaseApp.initializeApp(Context) first in Android

How do I make a secure HTTPS call from Android

How to make the Java to call a String from a XML file(In Android Studio)

Make a phone call without default native app Android

How can i make a call on wildcard numbers in my android application?