Giter VIP home page Giter VIP logo

flutter_facebook_sdk's Introduction

Facebook Sdk For Flutter

GitHub code size GitHub followers GitHub contributors Linkedin LinkedIn GitHub GitHub

facebook_sdk_flutter allows you to fetch deep links, deferred deep links and log facebook app events.

This was created using the latest facebook SDK to include support for iOS 14. The plugin currently supports app events and deeps links for iOS and Android.

Prerequisites

First of all, if you don't have one already, you must first create an app at Facebook developers: https://developers.facebook.com/

Get your app id (referred to as [APP_ID] below)

For IOS

  • If your code does not have CFBundleURLTypes, add the following just before the final element:
 <key>CFBundleURLTypes</key>
    <array>
      <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fb[APP_ID]</string>
      </array>
      </dict>
    </array>
    <key>FacebookAppID</key>
    <string>[APP_ID]</string>
    <key>FacebookDisplayName</key>
    <string>[DISPLAY_NAME]</string>
    <key>FacebookAutoLogAppEventsEnabled</key>
    <true/>
    <key>FacebookAdvertiserIDCollectionEnabled</key>
    <true/>

For Android

  • Add the following to your strings.xml file

<string name="facebook_app_id">[APP_ID]</string>
<string name="fb_login_protocol_scheme">fb[APP_ID]</string>

  • Add the following meta tag to the application element in AndroidManifest.xml

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

  • Add the following element in AndroidManifest.xml

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

  • Don't forget to replace [APP_ID] with your Application ID

flutter_facebook_sdk's People

Contributors

ciock avatar edunatalec avatar perez-danilo avatar saadfarhan124 avatar sadfarhan124 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutter_facebook_sdk's Issues

After adding sdk, android build is not working

Hi,

When i try to add facebook sdk to app, shows that android build has this problem. does anyone has this issue?

e: /Users/user/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_facebook_sdk-1.0.0/android/src/main/kotlin/saad/farhan/flutter_facebook_sdk/FlutterFacebookSdkPlugin.kt: (31, 1): Class 'FlutterFacebookSdkPlugin' is not abstract and does not implement abstract member public abstract fun onNewIntent(p0: Intent): Boolean defined in io.flutter.plugin.common.PluginRegistry.NewIntentListener
e: /Users/user/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_facebook_sdk-1.0.0/android/src/main/kotlin/saad/farhan/flutter_facebook_sdk/FlutterFacebookSdkPlugin.kt: (258, 5): 'onNewIntent' overrides nothing

Flutter 3.3.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision *** (4 months ago) • 2022-11-09 12:09:26 +0800
Engine • revision ***
Tools • Dart 2.18.4 • DevTools 2.15.0

'onNewIntent' overrides nothing, Class 'FlutterFacebookSdkPlugin' is not abstract and does not implement abstract member public abstract fun onNewIntent(p0: Intent): Boolean defined in io.flutter.plugin.common.PluginRegistry.NewIntentListener

Need update kotlin version 1.3.50 -> 1.6.10
remove ? (Intent?) -> Intent
My code handled exception:

    override fun onNewIntent(intent: Intent): Boolean {
        try {
            // some code
            deepLinkUrl = AppLinks.getTargetUrl(intent).toString()
            eventSink!!.success(deepLinkUrl)
        } catch (e: NullPointerException) {
            // handler
            return false
        }
        return false
    }

Facebook SDK Version deprecated

We are trying to integrate the package to use "app installs" as a target event for ads, but we get really strange behaivor and after digging deep the only thing that is left is, that we are using and old version of the SDK.

Android IOS
In the plugin you reference: implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
} for android (which is marked deprecated).

The newest version is:
The current version of the Facebook SDK for Android is version 11.2.0 and requires the Android API 15. (from https://developers.facebook.com/docs/android ) ...

Would be great if you could update it.

Screenshot 2021-08-06 at 09 40 18

CocoaPods could not find compatible versions for pod "FBSDKCoreKit"

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
In Podfile:
flutter_facebook_auth (from .symlinks/plugins/flutter_facebook_auth/ios) was resolved to 4.3.0, which depends on
FBSDKCoreKit (~> 13)

flutter_facebook_sdk (from `.symlinks/plugins/flutter_facebook_sdk/ios`) was resolved to 0.0.1, which depends on
  FBSDKCoreKit (~> 9.1.0)

Issu in setAdvertiserTracking

Hi everyone,

When I call the function setAdvertiserTracking. This function throw the bellow exception "Unhandled Exception: type 'Null' is not a subtype of type 'bool'".

Regards,
Daniel

events not showing from ios in events manager

i add plugin and info plist ios and android , but no events is appeared in events manager from ios as simulator and ios real device ,
,any suggestion to sole this problem ,
how to make sure the advertiser tracking is enabled ?

Bug: Methods marked with @UiThread must be executed on the main thread

Issue:
App crashes on FB ad with deferred link clicked on some OEMs like Oppo, with the error Methods marked with @UiThread must be executed on the main thread.

Version used:
flutter_facebook_sdk: 0.0.5

Full error log:

log

2021-10-27 00:24:10.419 27751-27800/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: com.bluepad.android, PID: 27751
java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: AsyncTask #4
at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:992)
at io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:736)
at io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:72)
at io.flutter.embedding.engine.dart.DartExecutor$DefaultBinaryMessenger.send(DartExecutor.java:363)
at io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:168)
at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation.success(EventChannel.java:221)
at saad.farhan.flutter_facebook_sdk.FlutterFacebookSdkPlugin$initFbSdk$1.onDeferredAppLinkDataFetched(FlutterFacebookSdkPlugin.kt:201)
at com.facebook.applinks.AppLinkData.fetchDeferredAppLinkFromServer(AppLinkData.java:248)
at com.facebook.applinks.AppLinkData.access$000(AppLinkData.java:50)
at com.facebook.applinks.AppLinkData$1.run(AppLinkData.java:151)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

File & code line responsible:
File path: flutter_facebook_sdk/android/src/main/kotlin/saad/farhan/flutter_facebook_sdk/FlutterFacebookSdkPlugin.kt
Line no: 201
Method: initFbSdk

Solution:
Just call the @UIThread marked code in ui-thread. Maybe like below-

sample Handler(Looper.getMainLooper()).post { eventSink!!.success(deepLinkUrl) }

I have a bug when I running in dev mode in flutter command line tool, Macbook arch x86_64

Hi, I'm trying to run the project with command line or VSCode and I got an error!
But when I run it in iOS simulator, but to run in production it's ok.

→ flutter run --flavor dev -t lib/mains/main_dev.dart                                                                                                                                                                [20e0b549]
Changing current working directory to: /Users/cassio/dev/git/mambo/flutter-app-src
Launching lib/mains/main_dev.dart on iPhone 12 Pro in debug mode...
Running Xcode build...                                                  
Xcode build done.                                            8,1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    /Users/cassio/.pub-cache/hosted/pub.dartlang.org/flutter_facebook_sdk-1.0.0/ios/Classes/SwiftFlutterFacebookSdkPlugin.swift:3:8: error: could not find module 'FBSDKCoreKit' for target 'arm64-apple-ios-simulator'; found:
    x86_64-apple-ios-simulator, x86_64
    import FBSDKCoreKit
           ^
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.

  • Flutter doctor
→ flutter doctor                                                                                                                                                                                                     [20e0b549]
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.4 20F71 darwin-x64, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] Android Studio (version 4.2)
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
[✓] IntelliJ IDEA Community Edition (version 2021.1.3)
[✓] VS Code (version 1.60.2)
[✓] Connected device (2 available)

• No issues found!

There is a trick to run on command line ?

I run the project in a MacBook arch x86_64.

Ran into error Execution failed for task ':flutter_facebook_sdk:compileDebugKotlin'. with Flutter 3

I upgraded to Flutter 3.0.1 and Kotlin version 1.6.10 and then started running into this error. Full log below:


e: /Users/justmegawatt/Utils/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_facebook_sdk-1.0.0/android/src/main/kotlin/saad/farhan/flutter_facebook_sdk/FlutterFacebookSdkPlugin.kt: (31, 1): Class 'FlutterFacebookSdkPlugin' is not abstract and does not implement abstract member public abstract fun onNewIntent(p0: Intent): Boolean defined in io.flutter.plugin.common.PluginRegistry.NewIntentListener
e: /Users/justmegawatt/Utils/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_facebook_sdk-1.0.0/android/src/main/kotlin/saad/farhan/flutter_facebook_sdk/FlutterFacebookSdkPlugin.kt: (258, 5): 'onNewIntent' overrides nothing

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_facebook_sdk:compileDebugKotlin'.
> Compilation error. See log for more details

Error when running build-ipa

I have this error

SwiftFlutterFacebookSdkPlugin.swift:178:47: error: 'nil' requires a contextual type
	ApplicationDelegate.initializeSDK(nil)

Does anybody else encountered this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.