通过自定义屏幕的Android更换本地呼出屏幕 [英] Replace native outgoing call Screen by custom screen android
问题描述
我试图启动我的自定义屏幕上可能包含来电显示的全屏图像和一些按钮像拒绝接听来电操作本机传出的来电屏幕的上方。使用这个我能够拨打电话,但我重定向到本地主叫屏...
I am trying to launch my custom screen on top of native outgoing caller screen that may contain full Screen image of Caller and some buttons for actions like reject call. Using this I am able to make call, but is redirecting me to native caller screen...
如何替换\覆盖
我的自定义屏幕屏幕中的默认呼叫屏幕?
How to replace\override
the default call screen by my custom screen screen?
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phonenumber)));
public class GetOutgoingNUmber extends BroadcastReceiver {
final static String INTENT_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER";
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.v("DileBroadCastReceiver","In onReceive()");
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(context, OutGoingScreen.class);
i.putExtras(intent);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(i);
}
}, 1000);
}
在这里OutGoingScreen是用于显示传出屏幕
here OutGoingScreen is for displaying outgoing screen
public class OutGoingScreen extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.outgoingscreen );
}
}
现在的问题是它显示我的屏幕为几毫秒,并再次显示本机屏幕....?
Now the problem is it is showing my screen for few msec and again showing native screen....?
推荐答案
写接收器呼出
public class OutgoingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, final Intent intent) {
//Write intent for yout page
}
}
这些添加到清单
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<receiver android:name=.OutgoingCallReceiver" >
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
下面的主题添加到活动主题
add below theme to activity theme
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
在1 minut bcoz原呼出屏幕需要800毫秒打开,所以你需要通过铺设的屏幕,所以你必须800毫秒后调用的意图打开你的意图。 它为我工作。
Open you intent after 1 minut bcoz the original outgoing call screen takes 800ms to open so you need to over lay that screen, so you must call intent after 800ms. it works for me.
这篇关于通过自定义屏幕的Android更换本地呼出屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!