2014-11-19 5 views
0

저는 csipsimple 버전 1915에서 작업하고 있습니다. 4.4.2 이하의 Android 기기에서 정상적으로 작동합니다. 로컬 네트워크에서 누군가에게 전화하려면이 방법이 있습니다.KitKat에서 전화를 걸 수 없습니다

private void broadCastAndroidCallState(String state, String number) { 
    //Android normalized event 
    Intent intent = new Intent(ACTION_PHONE_STATE_CHANGED); 
    intent.putExtra(TelephonyManager.EXTRA_STATE, state); 
    if (number != null) { 
     intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, number); 
    } 
    intent.putExtra(pjService.service.getString(R.string.app_name), true); 
    pjService.service.sendBroadcast(intent,android.Manifest.permission.READ_PHONE_STATE); 
} 

그러나 Android 버전 4.4.2에서는 작동하지 않습니다. 전화를 걸려고 할 때 충돌이 발생합니다. 내 코드를 다음과 같이 수정했습니다.

private void broadCastAndroidCallState(String state, String number) { 
     // Android normalized event 
     if(!Compatibility.isCompatible(19)) { 
      // Not allowed to do that from kitkat 
      Intent intent = new Intent(ACTION_PHONE_STATE_CHANGED); 
      intent.putExtra(TelephonyManager.EXTRA_STATE, state); 
      if (number != null) { 
       intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, number); 
      } 
      intent.putExtra(pjService.service.getString(R.string.app_name), true); 
      pjService.service.sendBroadcast(intent, android.Manifest.permission.READ_PHONE_STATE); 
     } 
    } 

이 애플리케이션을 수정하면 충돌이 발생하지 않지만 아무 것도들을 수 없습니다. 이걸 도와주세요.

답변

0

첫 번째 방법은 텍스트 뷰에서 전화 번호를 설정하고 텍스트 뷰에서 autoLink를 설정할 수있는 방법입니다. 그래서 모든 것을 다 처리합니다.

두 번째 것은

Intent callIntent = new Intent(Intent.ACTION_DIAL);   
callIntent.setData(Uri.parse("tel:"+phonenumber));   
startActivity(callIntent); 
+0

내 자바 클래스 그래서 내가 활동을 시작하지 못할 콜백을 확장하고 있다는 .... 전화를 걸 수있는 다른 방법이 무엇입니까? 또는 나를 위해 전체 코드를 공유 할 수 있습니까? –

+0

전체 코드를 공유하십시오. 오류를 수정할 수 있습니다. –

관련 문제