I get error java.lang:Sub broadcastreceiver_onreceive signature does not match expected signature shown after app starts, I assume as the sub starts.
What is the expected signature and how is it corrected?
Sub BroadcastReceiver_OnReceive (Action As String, i As Object)
'can only abort when sendOrderedbroadcast is called.
BnR.AbortBroadcast
Dim data As Intent = i
Dim reqAction As String = data.GetExtra("action")
Dim paramsObj As Object = data.GetExtra("data")
Dim params As Map
params = ConvertLib.convertToMap(paramsObj)
If lbResponseResult.IsInitialized == False Then
bResponseResult.Initialize("ResponseResult")
End If
lbResponseResult.Text = params
If reqAction == "Login" Then
'Login Actions
If params.ContainsKey("PlayerName") Then
PlayerName = params.Get("PlayerName")
Email1EdText.Text = PlayerName
lblPlayerName.Text = PlayerName
PlayInfo(1) = PlayerName
End If
If params.ContainsKey("PlayFabId") Then
PlayerNumber = params.Get("PlayFabId")
lblPNum.Text = PlayerNumber
PlayInfo(2) = PlayerNumber
End If
If params.ContainsKey("SessionTicket") Then
SessionTicket = params.Get("SessionTicket")
End If
ToastMessageShow("Login Success, Name:" & PlayerName, False)
GetLeaderBoard
Return
Else If reqAction == "BonusPoints" Then
ToastMessageShow(params, False)
Else If reqAction == "LeaderBoard" Then
Dim boardListData As List = params.Get("LeaderBoard")
Dim resultValue As StringBuilder
resultValue.Initialize
resultValue.Append("Leader Board (Position Wise)")
resultValue.Append(CRLF)
resultValue.Append("# --- Points --- Player Name")
resultValue.Append(CRLF)
Dim pos As Int
Dim topScore As Int
topScore = 0
For pos = 0 To boardListData.Size - 1
Dim rowObj As Object = boardListData.Get(pos)
Dim rowParams As Map
rowParams = ConvertLib.convertToMap(rowObj)
resultValue.Append(rowParams.Get("Position"))
resultValue.Append("---")
Dim curScore As Int
curScore = rowParams.Get("BonusPoints")
If curScore > topScore Then
topScore = curScore
End If
resultValue.Append(rowParams.Get("BonusPoints"))
resultValue.Append("---")
resultValue.Append(rowParams.Get("PlayerName"))
resultValue.Append(CRLF)
Next
lbResponseResult.Text = resultValue.ToString
If topScore > 0 Then
Dim topScoreBuilder As StringBuilder
topScoreBuilder.Initialize
topScoreBuilder.Append("Top Score is ")
topScoreBuilder.Append(topScore)
If lblHigh.IsInitialized == False Then
lblHigh.Initialize("lblHigh")
End If
lblHigh.Text = topScore
End If
End If
End Sub
What is the expected signature and how is it corrected?
Sub BroadcastReceiver_OnReceive (Action As String, i As Object)
'can only abort when sendOrderedbroadcast is called.
BnR.AbortBroadcast
Dim data As Intent = i
Dim reqAction As String = data.GetExtra("action")
Dim paramsObj As Object = data.GetExtra("data")
Dim params As Map
params = ConvertLib.convertToMap(paramsObj)
If lbResponseResult.IsInitialized == False Then
bResponseResult.Initialize("ResponseResult")
End If
lbResponseResult.Text = params
If reqAction == "Login" Then
'Login Actions
If params.ContainsKey("PlayerName") Then
PlayerName = params.Get("PlayerName")
Email1EdText.Text = PlayerName
lblPlayerName.Text = PlayerName
PlayInfo(1) = PlayerName
End If
If params.ContainsKey("PlayFabId") Then
PlayerNumber = params.Get("PlayFabId")
lblPNum.Text = PlayerNumber
PlayInfo(2) = PlayerNumber
End If
If params.ContainsKey("SessionTicket") Then
SessionTicket = params.Get("SessionTicket")
End If
ToastMessageShow("Login Success, Name:" & PlayerName, False)
GetLeaderBoard
Return
Else If reqAction == "BonusPoints" Then
ToastMessageShow(params, False)
Else If reqAction == "LeaderBoard" Then
Dim boardListData As List = params.Get("LeaderBoard")
Dim resultValue As StringBuilder
resultValue.Initialize
resultValue.Append("Leader Board (Position Wise)")
resultValue.Append(CRLF)
resultValue.Append("# --- Points --- Player Name")
resultValue.Append(CRLF)
Dim pos As Int
Dim topScore As Int
topScore = 0
For pos = 0 To boardListData.Size - 1
Dim rowObj As Object = boardListData.Get(pos)
Dim rowParams As Map
rowParams = ConvertLib.convertToMap(rowObj)
resultValue.Append(rowParams.Get("Position"))
resultValue.Append("---")
Dim curScore As Int
curScore = rowParams.Get("BonusPoints")
If curScore > topScore Then
topScore = curScore
End If
resultValue.Append(rowParams.Get("BonusPoints"))
resultValue.Append("---")
resultValue.Append(rowParams.Get("PlayerName"))
resultValue.Append(CRLF)
Next
lbResponseResult.Text = resultValue.ToString
If topScore > 0 Then
Dim topScoreBuilder As StringBuilder
topScoreBuilder.Initialize
topScoreBuilder.Append("Top Score is ")
topScoreBuilder.Append(topScore)
If lblHigh.IsInitialized == False Then
lblHigh.Initialize("lblHigh")
End If
lblHigh.Text = topScore
End If
End If
End Sub