想要在APP中加入與Facebook互動的功能,最方便的應該就是用Graph API 了!
而Titanium則把這件事情幫我們都準備好了,所以一旦用Titanium.Facebook.loggedIn做完登入的動作後,就可以用Titanium.Facebook.requestWithGraphPath來使用facebook的Graph API。
像是要取得使用者資料:
Titanium.Facebook.requestWithGraphPath('me', {}, 'GET', function(e) {
if (e.success) {
//something...
else if (e.error) {
//something....
}
});
要分享有圖片的網站連結在自己的留言牆上:
var data = {
link: "http://sample.com",
name: "我是連結標題",
message: "我是訊息",
caption: "我是副標題",
picture: "圖片URL",
description: "我是內容"
};
Titanium.Facebook.requestWithGraphPath('me/feed', data, 'POST', function(e){
if (e.success) {
var FbPost = JSON.parse(e.result);
FbPostID = FbPost.id;//在facebook的文章編號
}else{
Ti.API.info('FAIL!!!');
}
});
如果有把FbPostID記好,那就可以在該篇文章下留言跟按讚:
Titanium.Facebook.requestWithGraphPath(FbPostID+'/comments', {message: 我要留言}, 'POST', callbackAfterComment});
Titanium.Facebook.requestWithGraphPath(FbPostID+'/likes', {}, 'POST', callbackAfterLike);//讚啦!

您好
請問您會這個嗎?
http://developer.appcelerator.com/question/125756/starting-a-service-on-boot
我是用alloy 老實說我看不太懂要怎麼做
可否教學?
看起來就是用java寫一個服務的模組掛到alloy中。
你要不要先把不明白的地方或是卡住的提出來呢?
我不知道要怎麼把module掛到alloy耶…
那個位置要放在哪裡呢? (android)
我之前是放在/Library/Application Support/Titanium下面。
但是其實又一陣子沒再用了…