title: Make Bluetooth on Android 2.1 discoverable indefinitely
body: <p>I'm working on a research project which involves Bluetooth and the Android OS. I need to make Bluetooth discoverable indefinitely in order for the project to continue. </p>
  
  <p><em>The Problem:</em>  </p>
  
  <ul>
  <li>Android limits discoverability to 300 seconds.</li>
  <li>I cannot ask the user every 300 seconds to turn discoverability back on as my application is designed to run in the background without disturbing the user.</li>
  <li><em>As far as I am aware</em>, there is no way to increase the time though Android's GUI. Some sources have called this a safety feature, others have called this a bug. There may be a bit of truth in both...</li>
  </ul>
  
  <p><em>What I'm Trying / Have Tried:</em></p>
  
  <ul>
  <li>I'm trying to edit a stable release of <a href="http://www.cyanogenmod.com" rel="nofollow noreferrer">cyanogenmod</a> to turn the discoverability timer off (it's possible; there's a configuration file that needs to have a single number changed). This isn't working because I'm having verification problems with the resulting package. </li>
  <li>During the past week, I downloaded the <a href="http://github.com/CyanogenMod" rel="nofollow noreferrer">cyanogenmod source code</a>, changed a relevant class in the hope that it would make Bluetooth discoverable indefinitely, and tried to <a href="http://wiki.cyanogenmod.com/index.php/Compile_for_dream" rel="nofollow noreferrer">recompile.</a> This did not work because (a) the repo is frequently changed, leading to an unstable code base which fails to compile (OR, it could be that I'm using it incorrectly; just because it looked like it was the code's fault in many instances doesn't mean I should blame it for all the problems I encountered!) and (b) the repo decides to periodically "ignore" me (but <strong>not</strong> always, as I have gotten the code base before!), replying to my synchronization/connection attempts with:
  
  <blockquote>
    <p>fatal: The remote end hung up unexpectedly</p>
  </blockquote></li>
  </ul>
  
  <p>As you might imagine, the above two issues are problematic and very frustrating to deal with.<br>
  <em>More Info:</em></p>
  
  <ul>
  <li>I'm running Android 2.1 via cyanogenmod (v5 I believe). This means the phone is also rooted.</li>
  <li>I have a developer phone, which means that the bootloader is unlocked.</li>
  <li>My phone is an HTC Magic (32B).</li>
  </ul>
  
  <p><em>The Big Question:</em></p>
  
  <ul>
  <li>How can I make Bluetooth indefinitely discoverable on Android?</li>
  </ul>