display a picture on the dialer in android

Refresh

December 2018

Views

2.4k time

1

I want my app to display a picture, when an incoming call happens.

What I did so far is to catch the phone state.

My question is how can I now put an image on the foreground of the dialer?

Here is my snippet:

public class reviever extends BroadcastReceiver{

@Override
public void onReceive(Context context, Intent intent) {
    Log.d("TAG", "phone is ringing");

    new Thread() {
        public void run() {
            try {
                sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }.start();

    Intent toPop = new Intent(context, PicPop.class);
    toPop.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(toPop);
}}

manifest:

<activity
        android:name=".PicPop"
        android:theme="@android:style/Theme.Translucent">

    </activity>

my problem now is that all looks nice, i have a small picture on top of the stock dialer, and the background is translucent, but i cant answer the call. how can i change it so the picture will stay on top of the dialer but have an interaction with the dialer so to answer a call?

3 answers

1

Sorry, you can't. There are lots of things you can customize, including the dialer, but not the incoming/outgoing/during-call screens, for security reasons.

http://kschang.hubpages.com/hub/Full-Android-Customization-Guide-How-to-Change-Almost-Anything-In-Your-Android-Device

1

Yes You can start An Activity(from phone state receiver) with Picture/ImageView in it, But make sure you have Answer/Reject Button on your custom screen else it will not let user pick/reject the call.

P.S :- Behavior of this thing is different on different devices, Even on the same device it can not override Incall screen some times

2

I found a way. you only need to make the background of the activity transparent `android:theme="@android:style/Theme.Translucent.NoTitleBar" and declare the activity not touchable and show when locked:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);

thanks you all any way.