[Update]
got my ans from below link Thank to @ramaral
stackoverflow.com/a/12675356/2556111
I want to display a notification if only my current application are in background . if my current application is in foreground then display dialog box. so my workaround to display dialog from service is creating dialog theme and it works perfectly but how to decide whether my current application is in background or foreground ? if this is not possible or this is against android UI . then please give me other solution please