嗚嗚喔學習筆記: 9月 2014

搜尋此網誌

2014年9月22日 星期一

Corona SDK - [ facebook API 開發流程 ]


Step1 : 上Facebook 開發者網站註冊 https://developers.facebook.com/
           Apps -> Add a New App 


Step2 : 拿取 App ID 和 App Secret ,App Secret 需要點 Show才能看到。
Step3 : settings -> Yconteact Email -> 輸入email
Step4 : Status & Review -> YES    選擇YES。
Step5 : 把 App ID 和 App Secret 覆蓋到 sample code 裡相對應的地方 大功告成~
          PS: appId 和 apiKey 都是"字串",不可用數字嘗試....

PS : 只能使用在一個app上,如果要用在別的app上 流程又會新增一些了~

2014年9月4日 星期四

Corona SDK - [ android push notification : client 端 (推播)]

Corona – Android - notification
Step1 : 進入google 開發者網站
step2 : create project 











step3 :
點選剛剛建立的project

















Step 4 : 點開Apls
Google Clound Messaging for android  :  OFF-> ON
















Step 5 :
點選 credentirals -> create serverkey


















Step 6 :
拿到api key














Step 7 : 拿到 Project Number









Step 8 :
修改samplecode
C:\................\SampleCode\Notifications\GooglePushNotifications
1.   Config.lua ->
projectNumber = “這裡輸入上面拿到projectNumber”
2.   搜尋main.lua -> event.token
這裡event.token 的值就是 devicetoken
3.   Main.lua -> apikey = “輸入上面拿到的apikey”

結論: 需要拿到三個值:
api key , projectNumber , devicetoken 交給server
Ps :
1.   devicetoken 的值在安裝app時需要傳給 server server就能依據devicetoken 推撥給手機。
2.   sample code 是透過GOOGLE SERVER做推撥
如果要利用其他SERVER做推撥需要另外傳devicetokenserver

3.   資料要以POST的方式傳送,資料格式須為Json,且Json格式如下:
{ "registration_ids":["registration_id_1","registration_id_2",...,,"registration_id_n"],
"data":{"attr_1":value_1,"attr_1":value_2,...,"attr_n":value_n},
}