사용자 전화 번호가 +로 시작하면 전화를 끊고 특정 번호로 전화를 겁니다. 나는 아래의 코드처럼 BroadcastReceiver의 onReceive에서 이것을한다.Intent.action_call가 Galaxy S3의 BroadcastReceiver에서 작동하지 않았습니다.
public void onReceive(Context context, Intent intent) {
to = intent.getStringExtra("android.intent.extra.PHONE_NUMBER");
if (to == null)
return;
if (to.startsWith("+")) {
setResultData(null);
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:123456789"));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(callIntent);
Toast toast = Toast.makeText(context, "Call trap and Redirect", Toast.LENGTH_LONG);
toast.show();
return;
}
}
이 코드는 다른 모델에서는 잘 작동하지만 Galaxy S3에서는 작동하지 않습니다. 토스트 메시지 표시하지만 intent.action_call은 전화를 걸지 않습니다 ??? 그냥 조용한, logcat 오류가 없습니다.
이것은 브로드 캐스트 리시버 내부에서 시작하려는 경우에만 발생합니다. 활동에서 시작할 때 intent.action_call이 정상적으로 작동합니다. 어떤 생각?
더 많은 정보가 필요합니까? 문제가 발생합니까? – JoxTraex
Antony, 실제로 onReceive의 컨텍스트 매개 변수를 사용합니다 – user1084081
Jox Traex, 새로운 번호로 전화를해야하지만 그것은 단순한 것이 아닙니다. – user1084081