Use this code segment in your service
AlertDialog alertDialog;
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getBaseContext());
alertBuilder.setTitle("New Approvals Alert")
.setMessage("You have " + jObj.length() + " new transactions for your approvals")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
alertDialog = alertBuilder.create();
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
alertDialog.show();
Add this permission to your AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Get more from : http://techprogramme.com/