Skip to content Skip to sidebar Skip to footer

Android: Make Phone Call From Service

I try to make a phone call from inside a service. The code I use is: Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse('tel:' + number)); startActivity(inten

Solution 1:

try as to make a phone call from inside a service:

Intentintent=newIntent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + number));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
startActivity(intent);

Solution 2:

check in the manifest if the service is outside of any activity

Post a Comment for "Android: Make Phone Call From Service"