native.showAlert keeps popping up nonstop until the app crashes

So this alert is only supposed to pop up if there is an actual error but it happens wether there is an error or not and it just keeps popping up non stop until I close the app or it crashes. I cant figure out what’s wrong.

[lua]local function showError()
local alert = native.showAlert( “Sorry!”, " Please try again.", {“OK”} )
end

local timerID
local getThump = function(event)
–print_r(event)
if (event.isShake == true )then
–if (event.xInstant>.5 or event.xGravity>.5 or event.isShake>.5 == true)then
if(useSocial==‘facebook’ and not(facebook)) then
native.showAlert( ‘You are not logged into Facebook.’, {‘Ok’})
return true
end
print(‘isThumpActive’, isThumpActive)
if(isThumpActive) then
return true
end
local twitter = twitter or ‘’
local tumblr = tumblr or ‘’
local youtube = youtube or ‘’
local instagram = instagram or ‘’
local pinterest = pinterest or ‘’
local googleplus = googleplus or ‘’
local linkedin = linkedin or ‘’

isThumpActive = true
system.vibrate()
local message = ‘test’
if(message) then
message = url.escape(message)
end

local post = “thump[deviceid]=”…deviceId…"&thump[lat]="…latitudeText…"&thump[lng]="…longitudeText…"&thump[message]="…message…"&thump[fburl]="…facebook…"&thump[twitter]="…twitter…"&thump[tumblr]="…tumblr…"&thump[youtube]="…youtube…"&thump[instagram]="…instagram…"&thump[pinterest]="…pinterest…"&thump[googleplus]="…googleplus…"&thump[linkedin]="…linkedin

local response = {}
–local url = serverURL … ‘?action=getThump&’ … post

native.setActivityIndicator( true );
local attempts = 0
local gotThumps = 0
function retrieveThump( event )
print(‘attempts’, attempts, gotThumps)
if 2 == attempts then
isThumpActive = false
native.setActivityIndicator( false );
timer.cancel( event.source )
if(gotThumps==0) then
showError()
end
else

local timerevent = event
local function thumpRequest(event)
print_r(event)
if(not event.isError) then
native.setActivityIndicator( false )
local data = json.decode(event.response)
if(data) then
if(useSocial==‘facebook’ and data.facebook) then
gotThumps = gotThumps+1
isThumpActive = false
return true

elseif(useSocial==‘twitter’ and data.twitter and not(data.twitter==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
return true

elseif(useSocial==‘tumblr’ and data.tumblr and not(data.tumblr==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
return true

elseif(useSocial==‘youtube’ and data.youtube and not(data.youtube==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
return true

elseif(useSocial==‘instagram’ and data.instagram and not(data.instagram==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
return true

elseif(useSocial==‘pinterest’ and data.pinterest and not(data.pinterest==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
return true

elseif(useSocial==‘googleplus’ and data.googleplus and not(data.googleplus==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
system.openURL(‘http://www.google.com/+’ … data.googleplusID)
return true

elseif(useSocial==‘linkedin’ and data.linkedin and not(data.linkedin==’’)) then
gotThumps = gotThumps+1
isThumpActive = false
return true

else
timerID = timer.performWithDelay(200, retrieveThump)
end
else
timerID = timer.performWithDelay(200, retrieveThump)
end
end
end
print(‘requesting’, url)
network.request( url, ‘GET’, thumpRequest)
attempts = attempts + 1
end
end
end
timerID = timer.performWithDelay( 200, retrieveThump)
end [import]uid: 113560 topic_id: 32466 reply_id: 332466[/import]