title: Run a service with Root privileges or adding permissions with root
body: <p>I am currently developing an app that reads out SMS/Emails while driving. Many users wished support for WhatsApp / KakaoTalk.</p>
  
  <p>However, as there is no "official" way to receive their messages, there would be only three options, all requiring root:</p>
  
  <p>The easier way of scanning their database in a given intervall.</p>
  
  <ul>
  <li>Easy to implement.    </li>
  <li>However not battery efficient</li>
  <li>Also the messages are not read out immediately.</li>
  </ul>
  
  <p>An other way would be to run a service with root rights and register a receiver that listens for their push notifications. This has to be done with root, as both packages require a signature based permission for receiving their push notifications.</p>
  
  <ul>
  <li>Harder to implement</li>
  <li>Better user experience</li>
  </ul>
  
  <p>Also another thing came to my mind: Would it be possible to manually add permissions to an APK after installing? In that case I could add the c2dm permissions to my package.</p>
  
  <ul>
  <li>This would make things very easy</li>
  <li>However, I am a little bit scared of changing my app's permissions, as this is completely against the Android Sandbox principle.</li>
  <li>Still, if it would be possible, let me know!</li>
  </ul>
  
  <p>The problem is, how <em>exactly</em> do I run a service with root rights (is it actually possible)? <em>I know how to run shell commands or binaries with root</em>, but I have no idea how to start a part of an APK as root.</p>
  
  <p>Also, would it be possible to integrate a BroadcastReceiver into a binary? I have actually no experience with C/C++, especially in an android environment. </p>
  
  <p>Can you help me with that?
  Thanks. </p>
  
  <p>edit: Like I said in the comment, I <strong>do not want to use an AccesibilityService</strong>, as it does not fit my needs (eg it will give me "2 unread messages" if more then one is unread, also it does not include the full body).</p>
  
  <p>edit2: Just to clarify things: I know how to run commands with root. What I need to know is how to register a Broadcastreceiver, that receives a specific broadcast "normal"  receivers don't get, as the Broadcast itself requires a signature based permission I don't have.</p>