Search code examples
androidfacebookandroid-simple-facebook

Sromku facebook login issue


I'm trying to use SimpleFacebook SDK to log in and share something on my wall, but seems that is not possible because I get this in the logCat:

09-11 16:08:30.836: E/ActivityThread(12092): Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
09-11 16:08:30.876: E/com.facebook.LoginActivity(12092): Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance.

Here is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.masterdetailsexample"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:hardwareAccelerated="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/CustomActionBarTheme" >
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/app_id" />

        <activity
            android:name="com.example.masterdetailsexample.Splash"
            android:label="@string/app_name"
            android:launchMode="singleTop" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.masterdetailsexample.CircleListActivity"
            android:label="@string/app_name" />
        <activity
            android:name="com.example.masterdetailsexample.Main"
            android:label="@string/app_name"
            android:launchMode="singleInstance"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.Details"
            android:label="@string/app_name"
            android:launchMode="singleInstance"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.TestSearch"
            android:label="@string/app_name"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.FavoritesActivity"
            android:theme="@style/CustomActionBarTheme" />
        <activity
            android:name="com.example.masterdetailsexample.Overlay"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <activity
            android:name="com.example.masterdetailsexample.FullScreenBanner"
            android:theme="@android:style/Theme.NoTitleBar" />
        <activity
            android:name="com.example.masterdetailsexample.DevicesIntro"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <activity
            android:name="com.example.masterdetailsexample.CircleDetailActivity"
            android:label="Circle detail" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".CircleListActivity" />
        </activity>
        <activity
            android:name="com.facebook.LoginActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <!--
        <receiver android:name="com.example.masterdetailsexample.NetworkStateReceiver" >
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>
        -->
    </application>

</manifest>

Does anyone knows what is the issue here?


Solution

  • Check hashkey for fb app and app id in manifest

    1. Open https://developers.facebook.com/
    2. Register as developer
    3. Add new app
    4. Open Dashboard, where you can find App ID
    5. Add App ID in your AndroidManifest.xml

          <meta-data
              android:name="com.facebook.sdk.ApplicationId"
              android:value="**App ID**"
          />
      

    6. Open Settings and Add your email

    7. Add platform + Add Platform and choose Android
    8. Add your package name from your AndroidManifest.xml
    9. For hash key use 'keytool':

      keytool -exportcert -alias -keystore | openssl sha1 -binary | openssl base64

    Or programmatically:

    public void printHashKey() {
       try {
          PackageInfo info = getActivity().getPackageManager().getPackageInfo("com.gorbin.androidsocialnetworksextended.asne",
          PackageManager.GET_SIGNATURES);
          for (Signature signature : info.signatures) {
             MessageDigest md = MessageDigest.getInstance("SHA");
             md.update(signature.toByteArray());
             Log.d("HASH KEY:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
          }
       } catch (PackageManager.NameNotFoundException e) {
       } catch (NoSuchAlgorithmException e) {
       }
       }
    
    1. Open Status & Review and start app

    More detailed: https://developers.facebook.com/docs/android/getting-started/