开发者

Change android CallScreen

I'm developing an app that would change the Call screen UI of the android OS. Now i know, I can't replace the UI, i can overlay my custom activity over it. So that's what i tried to do.

I can receive the intent by android.intent.action.PHONE_STATE of the ringing state and it works fine however when i launch my own activity it goes to the background and android's native UI replaces it. Is there anyway to change that? I don't want to do Thread.sleep() (though as a last resort I might have to).

Here is the code:

Android Manifest:

 <receiver android:name=".callIntentReceiver">
        <intent-filter >
            <action android:name="android.intent.action.PHONE_STATE"/>
        </intent-filter>
    </receiver>

callIntentReceiver.j开发者_Python百科ava:

public class callIntentReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.e("SmartCaller","Working sort of");
        Intent intent = new Intent(context, mainActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                context.startActivity(intent);

    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜