user34825: the use case is:
i have a bitcoin-aware app A, which would then like to trigger a bitcoin payment request to be executed by an on-phone bitcoin wallet via the BIB20/bitcoin: URL mechanism.  Rather than generating the payment request directly and immediately for an arbitrary amount of bitcoin, is there a way to in effect ask the bitcoin wallet if it has at least N bitcoins in it first?
thanks, 
John from Kimbrough Software

user423: It is not possible, by design. Like Jestin said, the wallet's balance is not the business of other apps.

user2306: This is definitely possible. If your application is running as root, it can access the wallet files of Bitcoin wallets, which usually have fixed filenames and file headers. The downside of this approach is if there's a vulnerability in your software, someone can steal Bitcoins from your customers and install malware.
How else could this be done? A Bitcoin wallet could implement an API so that applications on the same phone can query the Bitcoin balance. There is definitely an argument for making this possible. I wouldn't compare it to rifling through a purse when entering a department store - it's most similar to how DigitalOcean charges me a cent and cancels the charge to test that my credit card is valid, before it rents servers to me.
As Andreas Schildbach says, this is intentionally not implemented. (Note that Schildbach is the maintainer of this Android wallet, and one of the contributors to BitcoinJ, which many Android wallets use behind the scenes.) Why wouldn't you want this feature? One reason is that many applications are supported by advertising/data collection. If this API were made available, many applications with no reason to have this information would ask for it. You can imagine that those companies would sell datasets that include email addresses and Bitcoin balances - the primary effect of this feature would be to add another vector to phish Bitcoin users.

34825: <p>the use case is:
i have a bitcoin-aware app A, which would then like to trigger a bitcoin payment request to be executed by an on-phone bitcoin wallet via the BIB20/bitcoin: URL mechanism.  Rather than generating the payment request directly and immediately for an arbitrary amount of bitcoin, is there a way to in effect ask the bitcoin wallet if it has at least N bitcoins in it first?</p>

<p>thanks, 
John from Kimbrough Software</p>
 423: <p>It is not possible, by design. Like Jestin said, the wallet's balance is not the business of other apps.</p>
 2306: <p>This is definitely possible. If your application is running as root, it can access the wallet files of Bitcoin wallets, which usually have fixed filenames and file headers. The downside of this approach is if there's a vulnerability in your software, someone can steal Bitcoins from your customers and install malware.</p>

<p>How else could this be done? A Bitcoin wallet could implement an API so that applications on the same phone can query the Bitcoin balance. There is definitely an argument for making this possible. I wouldn't compare it to rifling through a purse when entering a department store - it's most similar to how DigitalOcean charges me a cent and cancels the charge to test that my credit card is valid, before it rents servers to me.</p>

<p>As Andreas Schildbach says, this is intentionally not implemented. (Note that Schildbach is the maintainer of <a href="https://play.google.com/store/apps/details?id=de.schildbach.wallet&amp;hl=en" rel="nofollow noreferrer">this Android wallet</a>, and one of the contributors to BitcoinJ, which many Android wallets use behind the scenes.) Why wouldn't you want this feature? One reason is that many applications are supported by advertising/data collection. If this API were made available, many applications with no reason to have this information would ask for it. You can imagine that those companies would sell datasets that include email addresses and Bitcoin balances - the primary effect of this feature would be to add another vector to phish Bitcoin users.</p>
