Matej
Matej

Reputation: 8988

Call number from QR code

I got a problem that seems unsolvable. The problem is in generating the QR code that will call one specific number. Number format is *103*14 digit activation number# and reading it with an android QR code application causes absence of hash sign (#) in call form. I googled it and the conclusion is that android API for some reason prevents reading hash sign from the QR code. Workaround for android OS is using URI encoding for hash which is %23, in that case it works like a charm. But reading the same QR code with the iOS QRReader application doesn't convert %23 to hash, instead it just shows 23. Is there a solution that covers all of these problems? Thank you in advance!

Upvotes: 1

Views: 7909

Answers (2)

Terence Eden
Terence Eden

Reputation: 14304

You have to double-encode the hash, so the percent sign is also encoded.

So, the # becomes %2523

Scan this QR code and your phone dialer should show *#67#

URI encoded USSD Has QR

See this bug report on Zxing

Upvotes: 4

a.ch.
a.ch.

Reputation: 8380

Perhaps, you need to encode String before passing it to Intent:

String qrCode = "*103*14#";
String uri = Uri.encode("tel:" + qrCode);
Intent intent = new Intent(Intent.ACTION_CALL, uri);

Upvotes: 0

Related Questions