Android Question sentSms from a device with 2 sim cards

kalarius

Active Member
Licensed User
Longtime User
hi
B4X:
Sub SI_MessageReceived (From As String, Body As String) As Boolean
   'ToastMessageShow(From, True)
   ' εδω ελέγχω αν με ανδιαφέρει το μηνυμα 
 myTXT= Body
 myTXT=myTXT.ToLowerCase
  ToastMessageShow("receive sms" ,False)
   
      If myTXT.Contains("position")=True  Then 
              'sent an sms to receipient
            'myTXT="Lon="& Mhkos &" " & "Lat=" & Platos
            myTXT="Τελευταία γνωστή θέση την " & Hmeromhnia & " ώρα " & Vra & CRLF
            myTXT= myTXT & "https://maps.google.com/maps/place?q=" & Platos &"," &  Mhkos
            'SenSms.Send(Ar_kinhtoy,myTXT)
            SenSms.Send("0030693665xxx",myTXT) 
            ToastMessageShow("Send position", True)
            Return True  ' if return true the message aborted   I want to abord the message
     End If

I have galaxy duos with android ver 4.2.2
the above code runs as service
with the toastmessagesshow I can check that the proram pass from the code

When I place the sim card at position 2 it receive the sms and and recognize the word "position" and sent ? the message BUT the message never arrived to the other phone. (I have a device with one sim and this routine works ok)
also the return True it does not seems me to work because after a few second the message arrives to the sms folder

when I place the sim card at postion 1 the SI_MessageReceived never raised.
I use only 1 card

so what can I do with the senSms routine to sent the sms?
is there any code to choose between the sims cards (it does not matter which card I will use)



End Sub
 

kalarius

Active Member
Licensed User
Longtime User
no
The code above is a GPS tracker. When the phone receive an sms with body text = position it will sent back an sms with th eposition of the phone.
using the code
SenSms.Send("0030693665xxx",myTXT) 0030xxxxxx is the phone that receive the sms nad myTXT is the message of the sms.

I have 2 phones One with single sim card and the above code works fine (samsung galagy sIII)
and one with 2 sim cards and the above code does not work
the problem is at the phone with 2 sim cards. (samusung galaxy duos)

The phone with the 2 sim cards it receive the message and goes to the line senSms.sent(XXXnumber,text)
but the sms message does not arrive to phone with the xxxnumber.
(in debug mode I can see that the programm goes into the code)
 
Upvote 0

kalarius

Active Member
Licensed User
Longtime User
I try this code with LG leon and work fine

the only problem is that after it receive the message (with body ="position") and proccess it with my program I want to discard it.
I have in the code "Return true" but the message does not aborded

please
advice

Kalarakis
Creta
Greece
 
Upvote 0

kalarius

Active Member
Licensed User
Longtime User
ok
I read this and the main idea is that I must declare my service as the default application of the sms
so
I make a service that receive the sms
if the sms have the word "position" into the body then I proceed this sms with my program

if the sms is not for my application (does not have the word "position" into the body text) HOW can I broadcast it to other sms application ? (applications that are my phone)
 
Upvote 0
Top