I am working on an Android Email Application but have no idea how to put server side filter/rule on user request. The rule shall be defined by the user of the app.
Adding server side rules is necessary so that when user opens his account in Thunderbird/Outlook or web, he can get same kind of emails flow.
Server side filtering is entirely dependent on the facilities provided by the particular mail server; it is not part of the IMAP protocol.
While some ISPs may publish an interface for programmatically editing server side filter rules, you can't hope to provide a single client-side implementation of this in your Android app which will work across the board.