karimkhan
karimkhan

Reputation: 329

How can i change incoming call screen of phone in java?

I want to change incoming call screen to my own layout. I used a sample to do this for me. but it sometimes appear(when calling) and sometimes not. I do not know how to solve this problem that my own layout appear every time.

This is my codes.

public class PhoneStateReceiver extends BroadcastReceiver {

@Override
public void onReceive(final Context context, Intent intent) {

    Intent i = new Intent();
    i.setClass(context, MainActivity.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);

}

}

and this is the manifest.

<receiver android:name="com.example.changescreen.PhoneStateReceiver">
        <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />
        </intent-filter>
    </receiver>

Upvotes: 1

Views: 292

Answers (1)

JAAD
JAAD

Reputation: 12379

Try adding a delay before starting your activity.

The Problem is your activity is being overlapped by the default activity

Upvotes: 1

Related Questions