title: How to find the status of VPN connection through framework APIs or any other efficient method?
body: <p><strong>So far:</strong> </p>
  
  <p>I found the following solutions</p>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/a/10129444/730807">Using Broadcastreceiver</a></p>
  
  <p>The broadcast receiver is deprecated from ICS</p></li>
  <li><p><a href="http://developer.android.com/reference/java/net/InetAddress.html#isReachable(int)" rel="nofollow noreferrer">Using Ping or Traceroute</a></p>
  
  <p>It's definitely going to take lots of time and its not efficient</p></li>
  <li><p><a href="https://stackoverflow.com/a/16630021/3853188">Polling for DNS server changes</a></p>
  
  <p>It's definitely going to take lots of time and its not efficient</p></li>
  <li><p><a href="https://stackoverflow.com/a/24826862/3853188">Using ip-address</a></p>
  
  <p>Even though it won't take much time depending on the network connection it may vary</p></li>
  </ol>
  
  <p><strong>My conclusion:</strong></p>
  
  <p>So far all the solutions I found are either not efficient or not so reliable.</p>
  
  <p><strong>My questions:</strong></p>
  
  <p>If VPN is connected in android device then android OS must be aware of it.</p>
  
  <p>Are there any public android framework APIs to read it because finding it locally is most efficient and reliable solution ? </p>
  
  <p>Are there any other efficient and reliable ways to achieve it (like integrating a C or C plus plus library with NDK)?</p>
  
  <p><strong>Note:</strong></p>
  
  <p>I couldn't find any custom broadcast senders/AIDL from OpenVPN for Android as well </p>