All notifications (even other app notifications) can be removed via listening to 'NotificationListenerService' as mentioned in NotificationListenerService Implementation
In the service you have to call cancelAllNotifications().
The service has to be enabled for your application via ‘Apps & notifications’ -> ‘Special app access’ -> ‘Notifications access’.
Add to manifest:
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <service android:label="Test App" android:name="com.test.NotificationListenerEx" android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>
Then in code;
public class NotificationListenerEx extends NotificationListenerService {
public BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        NotificationListenerEx.this.cancelAllNotifications();
    }
};
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
    super.onNotificationPosted(sbn);
}
@Override
public void onNotificationRemoved(StatusBarNotification sbn) {
    super.onNotificationRemoved(sbn);
}
@Override
public IBinder onBind(Intent intent) {
    return super.onBind(intent);
}
@Override
public void onDestroy() {
    unregisterReceiver(broadcastReceiver);
    super.onDestroy();
}
@Override
public void onCreate() {
    super.onCreate();
    registerReceiver(broadcastReceiver, new IntentFilter("com.test.app"));
}
After that use the broadcast receiver to trigger the clear all.
As per the above code to trigger the broadcast use;
getContext().sendBroadcast(new Intent("com.test.app"));