zoukankan      html  css  js  c++  java
  • Android

    转自:http://www.dotblogs.com.tw/newmonkey48/archive/2014/04/17/144779.aspx

    App要使用Facebook 分享時,設要在Facebook應用程式裡設定app 的key hash

    但keyhash要怎麼取得呢?

    可參考兩個網址

    http://blog.changyy.org/2011/05/android-facebook-sdk.html

    http://blog.rx836.tw/blog/android-facebook-key-hashes/

    需下載 openssl

    http://blog.rx836.tw/blog/android-facebook-key-hashes/

    下載後,解壓縮,如下,到bin資料下底下取得openssl.exe

    C:UsersTomDownloadsopenssl-0.9.8h-1-binin

    放至Java目錄下,如下

    C:Program FilesJavajdk1.6.0_23in

    並從eclipse取得keystore放置位置

    [Windpw] -> [Preferences] -> [Android] -> [Build]  的 Default debug keystore

    我這邊取得的是

    C:UsersTom.androiddebug.keystore

    再來是使用Java bin底下的keytool,取得keyhash

    打如下的指令

    keytool -exportcert -alias androiddebugkey -keystore C:UsersTom.androiddebug.keystore | openssl sha1 -binary | openssl base64

    會顯示以下,並輸入預設密碼android

    輸入keystore 密碼:android

    就會取得keyhash

    再到facebook ->管理應用程式 ->自己的應用程式-> 設定 ,key hash 填入該keyhash即可。

    debug.keystore的預設資料如下

    Keystore name: "debug.keystore"
    Keystore password: "android"
    Key alias: "androiddebugkey"
    Key password: "android"
    CN: "CN=Android Debug,O=Android,C=US"

     
    所以密碼才填android
     

    注意:

    打不到的alias及密碼,都會影響keyhash的產生結果,必須與當時的alias及密碼相同。

    // mac平台

    1. First open a terminal (open a command prompt in windows).
    2. Navigate in the terminal to the directory where your Android debug.keystore is stored.
    3. Mostly it will located under “/Users/user_name/.android/” (In Windows will be C:Documents and Settings.android).
    4. Once you are in the “.android” directory, run the following command.

      keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64

    5. When it prompts you for a password, type android and hit Enter

    6. Copy the value printed in the terminal that ends with an “=” and paste it in the Key Hash field in Facebook. Then click the Save Changes button.

  • 相关阅读:
    【MySql存储过程】DATE_ADD用法
    MySQL日期时间函数大全
    mysql中增加某一时间段内的时间数据(包含:时间、年、月、日、第几周、季度)
    webService学习之路(二):springMVC集成CXF快速发布webService
    WebService 学习之路(一):了解并使用webService
    Python 运算符简介与用法
    python实现排列组合公式C(m,n)求值
    Python 学会字典 干货
    Python代码实现视频字符化
    python处理txt文件操作
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/3968908.html
Copyright © 2011-2022 走看看