here is the code :
–
– scence4-1.lua
–
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local widget = require( “widget” )
---------------------------------------------------------------------------------
– BEGINNING OF YOUR IMPLEMENTATION
local obj2 = display.newImage( “images/bg4-5.png”)
local btn1 = display.newImage( “images/btn_send.png”,151,415 )
local btn2 = display.newImage( “images/btn_cancel.png”,6,415 )
btn1.id = “send btn1 object”
local myname = GV_Name
local myid = GV_ID_NO
–print (myname)
–print(myid)
textBox = native.newTextBox(25, 95, 265, 305 )
local path = system.pathForFile( “data.txt”, system.DocumentsDirectory )
local file = io.open( path, “r” )
if file then
contents = file:read( “*a” )
--print(contents) – data from file, use this as input to textbox
--textBox.text = contents
io.close( file )
end
textBox:setReferencePoint(display.TopCenterReferencePoint)
--textBox.x = screenCenter
textBox.size = 16
textBox.isEditable = true
local my_text = contents
– onRelease listener for ‘sendSMS’ button
local function onSendSMS( event )
– compose an SMS message (doesn’t support attachments)
local options =
{
to = { “0505930118”, “9876543210” },
body = contents
}
native.showPopup(“sms”, options)
– NOTE: options table (and all child properties) are optional
end
local function onbtn1Touch( event )
if event.phase == “began” then
print( "Touch onbtn1Touch began on: " … event.target.id )
--onRelease = onSendSMS
end
return true
end
btn1:addEventListener( “touch”, onSendSMS )
print(textBox.text)
print(contents)
return scene
the code should do the following:
1- first time the user eneter his name and id , the code will store it into file, then
2- next time it will not ask for id and name…
3- user can select from menu options(1-5), then
4- the user will enter his note (textbox)
6- system will get the GPS location of phone
5- the system will handell all data (name,id,note,GPS data,date,time) and send it as SMS
6- the SMS should be sent to fixed number (2 mobile numbers)
Thanks