0

I start a phonecall using the following code:

public static void startPhoneCall(String number){
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(number));
    alarmActivity.startActivity(intent);
}

Strange things and some android magic seem to happen after this. Sometimes the call is made, and sometimes the call starts, but is terminated moments after. So the phone with number = number wont even receive the call.

I always use the same parameter for number, so the problem can't be there. Also, if I start the call "normally", it always works.

I have no idea where to search anymore, so any hint is very welcome!

edit: This is no duplicate of the following question: Android Intent.ACTION_CALL, Uri

The code is working. I can make the call, most of the times. The strange thing is, sometimes the call just ends right after it has started. Sometimes it works perfectly fine. However, in both of the cases, the number is indeed called. My problem is, as I said, that sometimes it just ends right after it started.

edit 2 I found the problem: I send sms at the same time at starting the call. if one sms is sent during the call is made, it will terminate the call. How can I ensure that all of my sms are sent before starting the call?

Community
  • 1
  • 1
Michael Kunst
  • 2,978
  • 25
  • 40

0 Answers0