Determining if Facebook app is installed from Unity

lysergic-acid

We are using the Facebook SDK for Unity (v6.0) and I'd like to now whether there's a way that I can check if the Facebook app is installed on the device.

The reason is an existing bug in the Facebook SDK (see here: bug)

I want to identify this scenario (occurs only when the FB app is installed), and react accordingly.

Berke Atmaca

"In order to use a native plugin you firstly need to write functions in a C-based language to access whatever features you need and compile them into a library. In Unity, you will also need to create a C# script which calls functions in the native library." from http://docs.unity3d.com/Manual/NativePlugins.html

So, basically you need to write your code in Objective-C and provide the communication between the Unity and the Native Code.

The code that you need to implement for checking Facebook APP is;

(void) checkFacebookApp
{
   if ([[UIApplication sharedApplication] canOpenURL:[NSURLURLWithString:@"fb://"]])   
   {
      return true;
   }
}

However you need some communication between the Unity and Xcode project. So;

 class SomeScript : MonoBehaviour {

   #if UNITY_IPHONE || UNITY_XBOX360

   // On iOS and Xbox 360 plugins are statically linked into
   // the executable, so we have to use __Internal as the
   // library name.
   [DllImport ("__Internal")]

   #else

   // Other platforms load plugins dynamically, so pass the name
   // of the plugin's dynamic library.
   [DllImport ("PluginName")]

   #endif

   private static extern float checkFacebookApp ();

   void Awake () {
      // Calls the FooPluginFunction inside the plugin
      // And prints 5 to the console
      bool check = checkFacebookApp ();
   }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Determining if Facebook app is installed from Unity

From Dev

Facebook Unity SDK on Android - Login fails when FB App installed

From Dev

Open Facebook Page in Facebook App (if installed) on Android

From Dev

UIActivityViewController Not Showing Facebook if Facebook App Installed

From Dev

PHP SDK-How to know whether or not person from Facebook has installed and authorized my app on Facebook?

From Dev

Json From Facebook and Unity

From Dev

Determining Software that is Already Installed

From Dev

How to detect if Facebook app is installed on iOS?

From Dev

Check if user has my Facebook app installed

From Dev

Fetch Facebook Friends list that not installed my app

From Dev

Facebook native login is not opening facebook app even if it's installed in device?

From Dev

Share Photo on Facebook using Facebook 4.0 without native app installed

From Dev

apportable facebook login error when facebook app is installed

From Dev

Upload picture to facebook from unity

From Dev

Upload picture to facebook from unity

From Dev

facebook linking from app to app

From Dev

How to get facebook app link if app wasn't installed

From Dev

Which Platform of Unity is best for Facebook Canvas App

From Dev

Programmatically determining if a Racket package is installed

From Dev

How to make the unity app search find a manually installed app

From Dev

Facebook profile link from safari to facebook app

From Dev

Facebook share text from app with facebook sdk

From Dev

Facebook Login - If user account is present (and app is not installed) login fails

From Dev

iOS 9 - Facebook fails to open installed iOS app

From Dev

How to get the list of Facebook friends who have not installed the app?

From Dev

Facebook login in IOS works on emulator but not on device with native app installed

From Dev

Ti.Facebook doesn't open authorize with FB app installed

From Dev

FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS

From Dev

Facebook login in IOS works on emulator but not on device with native app installed

Related Related

  1. 1

    Determining if Facebook app is installed from Unity

  2. 2

    Facebook Unity SDK on Android - Login fails when FB App installed

  3. 3

    Open Facebook Page in Facebook App (if installed) on Android

  4. 4

    UIActivityViewController Not Showing Facebook if Facebook App Installed

  5. 5

    PHP SDK-How to know whether or not person from Facebook has installed and authorized my app on Facebook?

  6. 6

    Json From Facebook and Unity

  7. 7

    Determining Software that is Already Installed

  8. 8

    How to detect if Facebook app is installed on iOS?

  9. 9

    Check if user has my Facebook app installed

  10. 10

    Fetch Facebook Friends list that not installed my app

  11. 11

    Facebook native login is not opening facebook app even if it's installed in device?

  12. 12

    Share Photo on Facebook using Facebook 4.0 without native app installed

  13. 13

    apportable facebook login error when facebook app is installed

  14. 14

    Upload picture to facebook from unity

  15. 15

    Upload picture to facebook from unity

  16. 16

    facebook linking from app to app

  17. 17

    How to get facebook app link if app wasn't installed

  18. 18

    Which Platform of Unity is best for Facebook Canvas App

  19. 19

    Programmatically determining if a Racket package is installed

  20. 20

    How to make the unity app search find a manually installed app

  21. 21

    Facebook profile link from safari to facebook app

  22. 22

    Facebook share text from app with facebook sdk

  23. 23

    Facebook Login - If user account is present (and app is not installed) login fails

  24. 24

    iOS 9 - Facebook fails to open installed iOS app

  25. 25

    How to get the list of Facebook friends who have not installed the app?

  26. 26

    Facebook login in IOS works on emulator but not on device with native app installed

  27. 27

    Ti.Facebook doesn't open authorize with FB app installed

  28. 28

    FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS

  29. 29

    Facebook login in IOS works on emulator but not on device with native app installed

HotTag

Archive