Replace native outgoing call Screen by custom screen android

后端 未结 3 657
眼角桃花
眼角桃花 2021-02-11 06:37

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

相关标签:
3条回答
  • 2021-02-11 06:58

    The best way to do so is develop your own Phone app and expect the user to set it as the default app for making calls.

    Edit:

    Add an Activity which accepts ACTION_DIAL intent and have a numeric keypad and then once user has entered the call number, you can fire ACTION_CALL intent with the phone number which would invoke the native phone app. This way also, the user has to select your app to be set as default one for ACTION_DIAL intent.

    0 讨论(0)
  • 2021-02-11 07:10

    You don't need to create a separate application. Ultimately you just want to handle the new outgoing call requests,so create a BroadcastReceiver to listen the event of ACTION_NEW_OUTGOING_CALL,and create an Activity to invoke upon that event.

    you will need to specify permission in manifest file about PROCESS_OUTGOING_CALLS.

    Have a look at some references:

    handling-phone-call-requests-right-way

    android-dialer-application

    I hope it will be helpful !

    0 讨论(0)
  • 2021-02-11 07:17

    Write a receiver for outgoing call

    public class OutgoingCallReceiver extends BroadcastReceiver {
    @Override
        public void onReceive(final Context context, final Intent intent) {
          //Write intent for yout page
      }
    }
    

    add these to Manifest

    <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"
    

    Open you intent after 1 second 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.

    0 讨论(0)
提交回复
热议问题