Extension moto: Call starts in Loudspeaker programatically, working only on few devices

Used permission :

"android.permission.MODIFY_AUDIO_SETTINGS"

Code :

>     @SimpleFunction(description = "") 
> 
>          public void SetLoudSpeaker(boolean toggled) {
> 
>             AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
> 
>             audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION );
> 
>             audioManager.setSpeakerphoneOn(toggled);
> 
>         }

working only on few devices, Could someone help me to resolve the issue

then maybe it cant change audio in those devices?

So how do the android default calling apps set call in loudspeaker when Loudspeaker button clicked on Call?

duh default

didnt understand what you are trying to say

i mean it can change because its a default app

If I make my app default will it works?