Android Question Sending SMS in background

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi,

Google has changed its policy for SMS permission.
This thread is clear : SMS permissions

I have tried this code :
B4X:
Dim In As Intent
Dim number = "0123456789" As String
In.Initialize(In.ACTION_VIEW, "sms:" & number)
In.PutExtra("sms_body", "this is the body")
StartActivity(In)

It works and launchs the default SMS App to send the message.

However this is not fully automatic s it is via the Activity of the default SMS App... I would like to find a way to send the SMS automatically and in the background.

Is there a trick or is it now definitively forbidden (unless your App is the default SMS App) ?

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Only the default SMS App can do this. Every other app does not have the rights.
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Only the default SMS App can do this. Every other app does not have the rights.


Well this is not really what I would call a good news...
That's a pity to kill this nice feature of Android...

However thank you for your promt answer !
 
Upvote 0

Geezer

Active Member
Licensed User
Longtime User
I have these 2 permissions

PERMISSION_SEND_SMS
PERMISSION_READ_PHONE_STATE

And then I use this
B4X:
Dim PH As PhoneSms
PH.Send( TextTo, Msg )

It will send it in the background, but will still show in the default SMS app logs as DonManfred said.
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
I have these 2 permissions

PERMISSION_SEND_SMS
PERMISSION_READ_PHONE_STATE

And then I use this
B4X:
Dim PH As PhoneSms
PH.Send( TextTo, Msg )

It will send it in the background, but will still show in the default SMS app logs as DonManfred said.

Yes this works, but will no longer work as this permission "PERMISSION_SEND_SMS" is considered as dangerous and will no longer be supported by Google unless your App is the default SMS App
 
Upvote 0

Geezer

Active Member
Licensed User
Longtime User
I missed the bit about Google Play, and my app is not on google play so still works. Sorry.
 
Upvote 0
Top