I am using libdbus library and have written code in C language in which I am trying to fetch the screen lock and unlock events using "com.canonical.Unity.Session","IsLocked" entry. The compilation is successful but when I run the code in superuser mode then I get the following error:
Connection Error (Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.)
When I run the code in Normal User mode (after exiting from root user), then it works absolutely fine.
Is there a way I can run this code as root user? As my entire application runs in root user environment.