Help Sending message and making call at same time

diddly101

Member
Licensed User
Longtime User
hey all,

Im kind of new the whole app creation environment, so was wondering if someone could lend me a hand in fixing this little problem.

im creating a button that when pressed sends the co-ordinates of the current position of the person in a text as well as calls the number at the same time. I am currently using pieces of code that i have found throughout the forum;

but when i press the button at the moment it calls and automatically ends the call and the message is sent.

and if i try and get it to send the co-ordinates the person is currently at, the message doesnt send at all, but the call works properly

Sending SMS code.

Sub SendSms(PhoneNumber As String, Text As String)
Dim ps As PhoneSms
Dim r As Reflector
r.Target = r.RunStaticMethod("android.telephony.SmsManager", "getDefault", Null, Null)
r.RunMethod4("sendTextMessage", Array As Object(PhoneNumber, Null, Text, Null, Null), _
Array As String("java.lang.String", "java.lang.String", "java.lang.String", _
"android.app.PendingIntent", "android.app.PendingIntent"))
End Sub


GPS label Code

Sub GPS_LocationChanged (Location1 As Location)
latLabel.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude)
longLabel.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude)
speedLabel.Text = "Speed = " & Location1.Speed
End Sub



Button click code

Sub Button_Click
Dim p As PhoneCalls
SendSms("123456789", "testing")
StartActivity(p.Call("123456789"))
End Sub



any advice would be helpful

kindest regards
luke
 

diddly101

Member
Licensed User
Longtime User
Does the call end because of the SMS message?
Yes, i tried removing the send message function and the call function works fine, then i tried removing the call function and the message function works fine, but for some reason when i try and use them simultaneously they dont wont to work ...

any suggestions ..?
 
Upvote 0
Top