-1

I want to disable incoming call and text notification and use my app to show notification.

Logic is that my app will stay in background and on incoming call/text my app will popup with a page where I will show notification.

Please can anyone help me how Can I disable default incoming call/text notification.

InsaneCat
  • 2,115
  • 5
  • 21
  • 40
Rakesh
  • 1
  • 1

1 Answers1

0

I was able to hide incoming call notifications by using full screen activity. incoming call notification is not visible only activity is visible.

  • obviously you need to create service to detect incoming call which will launch your activity.

Here is code I used for full screen activity

protected void onCreate(Bundle savedInstanceState) {
        this.getWindow().getDecorView().setSystemUiVisibility(getSystemUiFlags());

        setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT < 16) {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
        setContentView(R.layout.myviewxml);
}

the function

private static int getSystemUiFlags() {
    return View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_IMMERSIVE
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN;
}

The manifest entry

    <activity
        android:name=".MyActivity"
        android:label="@string/title_activity"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"></activity>

Hope this helps somebody.

Rakesh
  • 1
  • 1