[xamarin form]]Well in native android you have the telephony manager to check what is the state of your device > APP Dev

본문 바로가기

사이트 내 전체검색

APP Dev

[xamarin form]]Well in native android you have the telephony manager t…

작성일 19-10-31 18:35

페이지 정보

작성자sbLAB 조회 139회 댓글 0건

본문

https://stackoverflow.com/questions/52386242/xamarin-forms-how-to-know-when-a-call-is-currently-taking-place

Well in native android you have the telephony manager to check what is the state of your device:

It has three states:

  • Idle: when it's idle there is no call
  • Offhook: when Off-hook it is in call
  • Ringing: when Ringing

        var telephonyManagerService = (TelephonyManager)Xamarin.Forms.Forms.Context.GetSystemService(TelephonyService);
        var getCurrentState = telephonyManagerService?.CallState;
        switch (getCurrentState)
        {
            case CallState.Idle:
              //No call
                break;
            case CallState.Ringing:
              //Ringing 
                break;
            case CallState.Offhook:
              //On call
                break;
            default:
                break;
        }

댓글목록

등록된 댓글이 없습니다.

Copyright © 소유하신 도메인. All rights reserved.
PC 버전으로 보기