Adding a button to the default incoming call screen on Android

I am developing an Android application for which I need to add a button on the incoming call screen. Can I add a new button to an existing incoming call screen or create my own screen specific to my application?

Edit: I want to add a button in addition to the Answer and Reject buttons on the screen that appears when an incoming call.

+3
source share
5 answers

I searched for the same functionality and found this open source project, http://code.google.com/p/incomingcallplus/

Not played with it yet, but it seems to be doing what you are looking for.

+3
source

Yes and no.

, . , ( , ) , , . , , .

+3

, - main.xml:

<Button android:id="@+id/helloButton" android:layout_height="wrap_content" android:layout_width="wrap_content" text="Hello Button" />

"Launcher" ..

+1

, , ; "".

, .

+1
source
public void addInvitePopup(final String number,Context c){
    //check if pref is ok with invite in call
   // if(!Preferences.getInstance(c.getInviteInCall())){return ; }
    // sets the WindowManager
    WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);

    WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.TYPE_SYSTEM_ALERT | 
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            PixelFormat.TRANSLUCENT);
    params.x = 250;
    params.height = LayoutParams.WRAP_CONTENT;
    params.width = LayoutParams.WRAP_CONTENT;
    params.format = PixelFormat.TRANSLUCENT;
     final Context ct =c;

    params.gravity = Gravity.TOP;
    params.setTitle("Testing");

    LinearLayout ly = new LinearLayout(c);
    ly.setOrientation(LinearLayout.VERTICAL);

    Button inviteButton = new Button(c);
    inviteButton.setClickable(true);
    inviteButton.setBackgroundDrawable(c.getResources().getDrawable(R.drawable.icon));
    inviteButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(v.getContext(), "adding to blacklist..", Toast.LENGTH_LONG).show();
            v.setBackgroundDrawable(ct.getResources().getDrawable(R.drawable.images));
            v.setClickable(false);
           // sendMessage(v, number);

            //Track this event:
            //MixPanelTracking.setPropKeyValue(getApplicationContext(), null, null, "Add friend - During Call");
        }
    });

also be sure to add permission: android.permission.SYSTEM_ALERT_WINDOW in the manifest file

+1
source

All Articles