- Home /
[Android] How to check if device can send SMS?
Hi.
My app sends sms. If You are wondering how to get this done, here it is:
`Application.OpenURL("sms:" + number + "?body=" + msg);`
Where number is phone number to send to and msg is message. This opens default sms app on device with said data input.
Now what I need is to check if device can send SMS (or at least catch error when it can not). Now it just crashes on button press (if it can not send SMS). It is quite a problem, really. Any workaround would be welcome. Even if it would mean building two APKs.
Thanks in advance!
I'd quite like to answer this but I can't.
I think you need to check for a phone connection ins$$anonymous$$d of sms capability, check for a null operation or Catch the Exception.
Device capability is something that is handled in the manifest. Normally, operations that involve a non-present device are simply ignored.
Thanks for the anwser!
I was hoping that I would not need to mess around in manifest since I have no knowledge in that matter.
I tried catching exception. Did not helped. I think the problem is, since it is OpenURL it does not throw any exception because it works properly - opens url. The thing is that device can not really open it and app crashes.
Your answer
Follow this Question
Related Questions
Error Building Player: 'aapt.exe' Win32Exception 3 Answers
Connect Andorid Phone and get error 1 Answer
BCE0044 unexpected char: 0xFEFF 2 Answers
Unity Editor & iOS - Download MP4 to Streaming Assets Folder 0 Answers
errors building on android 0 Answers