

<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facebook &#8211; Max的程式語言筆記</title>
	<atom:link href="https://stackoverflow.max-everyday.com/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>https://stackoverflow.max-everyday.com</link>
	<description>我要當一個豬頭，快樂過每一天</description>
	<lastBuildDate>Sun, 25 Jun 2017 23:05:34 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://stackoverflow.max-everyday.com/wp-content/uploads/2017/02/max-stackoverflow-256.png</url>
	<title>Facebook &#8211; Max的程式語言筆記</title>
	<link>https://stackoverflow.max-everyday.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How To Find Someones Facebook ID</title>
		<link>https://stackoverflow.max-everyday.com/2017/06/how-to-find-someones-facebook-id/</link>
					<comments>https://stackoverflow.max-everyday.com/2017/06/how-to-find-someones-facebook-id/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Sun, 25 Jun 2017 23:05:34 +0000</pubDate>
				<category><![CDATA[電腦相關應用]]></category>
		<category><![CDATA[Facebook]]></category>
		<guid isPermaLink="false">http://stackoverflow.max-everyday.com/?p=940</guid>

					<description><![CDATA[如何知道某個人的 Facebook ID? 答案...]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignnone size-full wp-image-941" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2017/06/how-to-find-out-your-facebook-id-number.jpg" alt="" width="718" height="34" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2017/06/how-to-find-out-your-facebook-id-number.jpg 718w, https://stackoverflow.max-everyday.com/wp-content/uploads/2017/06/how-to-find-out-your-facebook-id-number-600x28.jpg 600w" sizes="(max-width: 718px) 100vw, 718px" /></p>
<p>如何知道某個人的 Facebook ID?</p>
<p>答案在某一個人的大頭照的網址裡，set 參數的最後一個小數點後面。</p>
<p>例如這一個人：</p>
<p><a href="https://www.facebook.com/winston.gonzalez.123276">https://www.facebook.com/winston.gonzalez.123276</a></p>
<p>大頭照的連結：</p>
<p>https://www.facebook.com/photo.php?fbid=108178469802600&#038;set=a.108178489802598.1073741826.100018313424511&#038;type=3&#038;source=11&#038;referrer_profile_id=100018313424511</p>
<p>&nbsp;</p>
<p>紅色部份，就是Facebook ID:<br />
https://www.facebook.com/photo.php?fbid=108178469802600&amp;set=a.108178489802598.1073741826.<span style="color: #ff0000;"><strong>100018313424511</strong></span>&amp;type=3&amp;source=11&amp;referrer_profile_id=100018313424511</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2017/06/how-to-find-someones-facebook-id/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Python] facebook api in python 取得發佈文章與個人資訊</title>
		<link>https://stackoverflow.max-everyday.com/2017/02/python-facebook-api/</link>
					<comments>https://stackoverflow.max-everyday.com/2017/02/python-facebook-api/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Fri, 17 Feb 2017 13:31:09 +0000</pubDate>
				<category><![CDATA[Python筆記]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">http://stackoverflow.max-everyday.com/?p=182</guid>

					<description><![CDATA[要先用  pip install faceboo...]]></description>
										<content:encoded><![CDATA[<p>要先用  pip install facebook-sdk, 我之前是用 pip install facebook, 結果程式不能跑，我們需要的是 facebook-sdk。</p>
<p>好心人寫的文件：<br />
<a href="https://facebook-sdk.readthedocs.io/en/latest/api.html">https://facebook-sdk.readthedocs.io/en/latest/api.html</a></p>
<p>Facebook The Graph API 文件：<br />
<a href="https://developers.facebook.com/docs/graph-api">https://developers.facebook.com/docs/graph-api</a></p>
<p>實用的範例：<br />
<a href="https://developers.facebook.com/docs/graph-api/reference/user">https://developers.facebook.com/docs/graph-api/reference/user</a></p>
<p>&nbsp;</p>
<h4>相關文章：</h4>
<p>[Python] facebook api in python 取得發佈文章與個人資訊<br />
<a href="http://jialin128.pixnet.net/blog/post/151421243">http://jialin128.pixnet.net/blog/post/151421243</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2017/02/python-facebook-api/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Android]實作Facebook login</title>
		<link>https://stackoverflow.max-everyday.com/2016/09/android-facebook-login/</link>
					<comments>https://stackoverflow.max-everyday.com/2016/09/android-facebook-login/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Tue, 13 Sep 2016 16:53:54 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Facebook]]></category>
		<guid isPermaLink="false">http://stackoverflow.max-everyday.com/?p=64</guid>

					<description><![CDATA[已經做過在Android 登入 facebook...]]></description>
										<content:encoded><![CDATA[<p>已經做過在Android 登入 facebook 的 app 很多次，不知道為什麼每次重新實做的時候就跟新人一樣，完全茫然不知道以前做了什麼，怎麼實作出來，可能是 facebook 太貼心，把教學做的很好，一步步照著畫面需要的資料填進去就完成了。</p>
<p>首先，到Facebook Developer 開發者中心：<a href="https://developers.facebook.com/">https://developers.facebook.com/</a> 點選新增App.</p>
<p>建好Facebook App 之後，在 Facebook App 裡增加平台(Platform)，選  Android。就可以看到「Quick Start for Android」的教學，照FB官方教學裡的設定，一下子就設定好了。</p>
<p>&nbsp;</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/09/Screenshot-2016-09-14-07.38.44.jpg"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1306" src="http://max-everyday.com/wp-content/uploads/2016/09/Screenshot-2016-09-14-07.38.44.jpg" alt="screenshot-2016-09-14-07-38-44" width="1864" height="1376" /></a></p>
<p>facebook 說總共分5個 Step, 第6個是finish, 就大功告成。</p>
<p>&nbsp;</p>
<p>FB 還有一個地方要設定，就是 App Review 裡要設為Public:</p>
<p><img decoding="async" class="alignnone size-full wp-image-921" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2016/09/Screenshot-2017-06-24-03.51.43.jpg" alt="" width="1024" height="215" srcset="https://stackoverflow.max-everyday.com/wp-content/uploads/2016/09/Screenshot-2017-06-24-03.51.43.jpg 1024w, https://stackoverflow.max-everyday.com/wp-content/uploads/2016/09/Screenshot-2017-06-24-03.51.43-600x126.jpg 600w, https://stackoverflow.max-everyday.com/wp-content/uploads/2016/09/Screenshot-2017-06-24-03.51.43-768x161.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<hr />
<p>在設定 月build.gradle 的 dependencies {&#8230;} 可能會因為版本號碼的差異造成無法Sync, 這個請使用</p>
<p>「File」 &#8211; 「Project Structure」來完成，如下圖所示：</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/09/Screenshot-2016-09-14-08.12.52.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1307" src="http://max-everyday.com/wp-content/uploads/2016/09/Screenshot-2016-09-14-08.12.52.jpg" alt="screenshot-2016-09-14-08-12-52" width="1644" height="1386" /></a></p>
<p>在 Step 4: Add your development and release key hashes，facebook login 和 LINE login 有一個差別在這，LINE Login 只能填1組，不能像facebook 把 dev/release key 都填進來，所以 LINE Login 要測試時有點麻煩，需要在 client side 或 server side 上切換 key.</p>
<p>結論是，似乎很簡單，填完 hash key 之後，把相關的 code 放進 app 裡就可以 run 了。</p>
<p>接下來就是增加Login 按鈕：</p>
<p><a href="https://developers.facebook.com/docs/facebook-login/android/#addbutton">https://developers.facebook.com/docs/facebook-login/android/#addbutton</a></p>
<p>login 完成後，可以在 client side 拿到 auth token, ex:<br />
String token = loginResult.getAccessToken().getToken();</p>
<hr />
<p>已經拿到 user的token, 就可以在 server side 執行下面URL:<br />
https://graph.facebook.com/me?access_token=拿到的脫肯</p>
<p>可以取得一個json:<br />
{&#8220;name&#8221;:&#8221;Max&#8221;,&#8221;id&#8221;:&#8221;12345&#8243;}</p>
<hr />
<p>要取得facebook用戶的大頭照可以這樣做：</p>
<p>50&#215;50 pixels<br />
maximum width of 50 pixels and a maximum height of 150 pixels.<br />
http://graph.facebook.com/1424180097599328/picture</p>
<p>maximum width of 200 pixels and a maximum height of 600 pixels.<br />
Large size photo https://graph.facebook.com/{facebookId}/picture?type=large</p>
<p>maximum width of 100 pixels and a maximum height of 300 pixels.<br />
Medium size photo https://graph.facebook.com/{facebookId}/picture?type=normal</p>
<p>Small size photo https://graph.facebook.com/{facebookId}/picture?type=small</p>
<p>maximum width and height of 50 pixels.<br />
Square photo https://graph.facebook.com/{facebookId}/picture?type=square</p>
<p>CLARIFICATION<br />
https://graph.facebook.com/redbull/picture?width=140&#038;height=110<br />
it will return a JSON response if you are using one of the Facebook SDKs request methods. Otherwise it will return the image itself. To always retrieve the JSON, add:</p>
<p>&amp;redirect=false<br />
like so:<br />
https://graph.facebook.com/redbull/picture?width=140&#038;height=110&#038;redirect=false</p>
<hr />
<p>Facebook API , debug 用的 url</p>
<p><a href="https://developers.facebook.com/tools/explorer/">https://developers.facebook.com/tools/explorer/</a></p>
<hr />
<p>接下來，其他進階的API 要這樣子call:</p>
<p><a href="https://developers.facebook.com/docs/android/graph/">https://developers.facebook.com/docs/android/graph/</a></p>
<pre class="_5s-8 prettyprint lang-code prettyprinted"><span class="typ">GraphRequest</span><span class="pln"> request </span><span class="pun">=</span> <span class="typ">GraphRequest</span><span class="pun">.</span><span class="pln">newMeRequest</span><span class="pun">(</span><span class="pln">
        accessToken</span><span class="pun">,</span>
        <span class="kwd">new</span> <span class="typ">GraphRequest</span><span class="pun">.</span><span class="typ">GraphJSONObjectCallback</span><span class="pun">()</span> <span class="pun">{</span>
            <span class="lit">@Override</span>
            <span class="kwd">public</span> <span class="kwd">void</span><span class="pln"> onCompleted</span><span class="pun">(</span>
                   <span class="typ">JSONObject</span> <span class="kwd">object</span><span class="pun">,</span>
                   <span class="typ">GraphResponse</span><span class="pln"> response</span><span class="pun">)</span> <span class="pun">{</span>
                <span class="com">// Application code</span>
            <span class="pun">}</span>
        <span class="pun">});</span>
<span class="typ">Bundle</span><span class="pln"> parameters </span><span class="pun">=</span> <span class="kwd">new</span> <span class="typ">Bundle</span><span class="pun">();</span><span class="pln">
parameters</span><span class="pun">.</span><span class="pln">putString</span><span class="pun">(</span><span class="str">"fields"</span><span class="pun">,</span> <span class="str">"id,name,link"</span><span class="pun">);</span><span class="pln">
request</span><span class="pun">.</span><span class="pln">setParameters</span><span class="pun">(</span><span class="pln">parameters</span><span class="pun">);</span><span class="pln">
request</span><span class="pun">.</span><span class="pln">executeAsync</span><span class="pun">();</span></pre>
<p>Facebook  Graph API guide:<br />
<a href="https://developers.facebook.com/docs/graph-api/using-graph-api/">https://developers.facebook.com/docs/graph-api/using-graph-api/</a></p>
<hr />
<h4>相關文章：</h4>
<p>[Android] Add buttons to PreferenceFragment<br />
<a href="http://max-everyday.com/2016/08/add-buttons-to-preferencefragment/">http://max-everyday.com/2016/08/add-buttons-to-preferencefragment/</a></p>
<p>Facebook login 和 LINE Login 相比：</p>
<ul>
<li>Facebook在設定開發者的憑證(Android Package Signature) 上面比LINE 方便，可以同時設定 developing ／released 的碼.</li>
<li>Facebook 使用者多。</li>
<li>Facebook 允許developer 拿到 user 公開的 id, photo 和 email, LINE 不能拿到公開 LINE ID。</li>
<li>Facebook 的 status 從 developing 切換到 published 不需要「先」通過人工審核，切換一下很快，所有的人都可以存取我們的App，並立即取得facebook 帳號的授權。</li>
<li>比較特別的是當使用我們facebook App 的人多了，facebook 會寄通知信來，要求在 facebook 的設定裡增加隱私權的宣告，那也很簡單，網路上有很多產生獸，點一點就完成了。</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2016/09/android-facebook-login/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
