Does anyone have Corona SDK mobile? Most of Corona Users used Parse but it’s tome to move somewhere safe… Please let me know.
Hi Maciej,
We do not have the official SDK for Corona. We had someone who tried out the REST API and that person wrote a few blog posts:
https://backendless.com/category/corona/
I think the best approach with Backendless would be to use the REST APIs directly.
Regards,
Mark
Great,
I’ll have a look and maybe prepare some basic implementation for Corona.
Thanks
Fantastic! Let us know if you have any questions about the REST API.
I am trying to use the REST API with corona to send push notifications. I can successfully register the device and it shows in the console, but the when I send a push message thru the console it disappears.
local tempTable = {}
tempTable.deviceToken = “XXXXXXXXXXXX”
tempTable.deviceId = system.getInfo( “deviceID” )
tempTable.os = “ANDROID” --system.getInfo( “platformName” )
tempTable.osVersion = system.getInfo( “platformVersion” )
tempTable.channels = {“Deadhead”}
local timeTable = { year = 2017, day = 1, month = 1, hour = 0, min = 0 }
local TimeinMilliseconds = os.time( timeTable )
tempTable.expiration = "2017-01-01"
printTable( tempTable, "tempTable")
local jsonData = json.encode(tempTable)
local params = {}
params.headers = headers
params.body = jsonData
local function registrations( event )
print("registrations",event.isError)
if ( event.isError ) then
print("Network error!")
else
print("Response - SaveScore"..event.response)
local response = json.decode(event.response)
printTable( response, "registrations")
end
end
network.request( "https://api.backendless.com/v1/messaging/registrations", "POST", registrations, params)
Tracey,
Please clarify the following:
- Is Corona app responsible for publishing notifications or will it be receiving them as well?
Did you add Google API key in Backendless console? (Manage > App Settings > Mobile Settings)
The corona app will will only be receiving messages.
Yes, I have added the Google API Key to the Backendless console and and the registrations do appear under the device tab for a brief period until I try to use the console to do a push messages. Then they all disappear.
If registrations disappear, it means the device makes an API call to unregister.
ok I got it working! I was passing the wrong deviceToken in the backendless call. I needed to use the corona plug in to register the device with google first then use the id I got from that to register with backendless.
I am receiving the notifications from the console, but the title is blank when I receive it on the device. I have tried using the headers to set the title but it doesn’t seem to work. These are the headers I used when sending the message from the console.
"android-ticker-text": "You just got a push", "android-content-title": "This is a notification", "android-content-text": "Push Notifications are cool"
Hi Tracey,
Great news!! Do they work if you publish a notification using the API?
Regards,
Mark
The title is still blank on the device when I receive a message even after including the headers in the API call. Below it the code in Corona using the REST API. Thanks for your assistance.
function sendMessage(message, deviceId)
print(“sendMessage”, message, deviceId)
local tempTable = {}
tempTable.message = message
tempTable.headers = {["android-ticker-text"] = "You just got a push ",["android-content-title"] = "This is a notification ", ["android-content-text"] = "Push Notifications are cool"}
tempTable.pushPolicy = "ONLY"
tempTable.pushBroadcast = "ANDROID"
– tempTable.pushSinglecast = {deviceId}
– tempTable.publishAt =
local jsonData = json.encode(tempTable)
local params = {}
params.headers = headers
params.body = jsonData
local function aftermessagesend( event )
if ( event.isError ) then
print("Network error!")
else
print("Response"..event.response)
local response = json.decode(event.response)
printTable( response, "aftermessagesend")
end
end
network.request( "https://api.backendless.com/v1/messaging/Default", "POST", aftermessagesend, params)
end
Tracy,
Thank you, this is helpful. I think the issue must be somewhere in how the “jsonData” is formed. Would it be possible to get the raw value sent to the server and post it here (as a JSON string)?
Regards,
Mark