title: Guidelines on how and when to keep cordova app running in background
body: <p>I have a Cordova aka Phonegap app, that receives emails from server using BOSH technology. User will me getting IM messages and also emails from other users. For this I need to run my app in background forever until and unless user forcefully want to close it. I have gone through different plugins like <a href="https://github.com/katzer/cordova-plugin-background-mode">https://github.com/katzer/cordova-plugin-background-mode</a>.</p>
  
  <p>And also options like <code>&lt;preference name="keepRunning" value="true" /&gt;</code></p>
  
  <p>And gone through <a href="https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20">articles</a> at Apple developer site.</p>
  
  <p>And some plugin says location permission need to be granted for iOS app to run JS in background.</p>
  
  <p>After going through all the above, I have got few questions as I am not native developer and mostly depend on my JS skills and Cordova plugins (I heart fully thank their authors).</p>
  
  <p>My Target platforms are iOS, Android, WP7, WP8, Blackberry</p>
  
  <p>Below are my questions</p>
  
  <ol>
  <li><p>What is the best way to keep JS running in the background so that user will receive mails and messages uninterruptedly as they are very important for user.</p></li>
  <li><p>Are there any plugins available and which are accepted by appStore team people.</p></li>
  <li><p>Does push notifications help in this case? If yes my server does not have any other integrations to let other servers know what is new message, how can I overcome this.</p></li>
  <li><p>Does appStore reject these kind of apps running in the background?</p></li>
  </ol>
  
  <p>Please help me, I am in need of answers for these questions, not just asking for learning purpose.</p>
  
  <p>Thanks.</p>