简体   繁体   English

Facebook Android SDK仅在安装本机应用程序时有效

[英]Facebook Android SDK only working when native app installed

I have created a game in Unity3D and installed the Facebook SDK for Unity. 我已经在Unity3D中创建了一个游戏,并为Unity安装了Facebook SDK。 I want to use the Facebook SDK for a very simple purpose, to track the app installs and the app launches, I do not require the Facebook Login or any other features. 我想将Facebook SDK用于一个非常简单的用途,以跟踪应用安装和应用启动,我不需要Facebook登录或任何其他功能。

When I published the game from Unity to iOS everything worked as expected, however, when publishing the game to Android, the events were not being registered by Facebook. 当我将游戏从Unity发行到iOS时,一切都按预期进行,但是,当将游戏发行到Android时,Facebook并未注册事件。

After posting this question Facebook Android SDK not registering installs @MingLi pointed out that either the Facebook Native app needs to be installed, and when I installed the native app the events started registering! 发布此问题后, Facebook Android SDK未注册安装 @MingLi指出,要么需要安装Facebook本机应用程序,当我安装本机应用程序时,事件开始注册!

When the Native FB app is not installed I get this error: 当未安装本机FB应用程序时,出现此错误:

Warning: Sessionless Request needs token but missing either application ID or client token

I have tried searching for a solution for that error, but nothing that I could find solves it without having the Native app installed. 我曾尝试寻找该错误的解决方案,但是如果没有安装本机应用程序,我找不到能解决的方法。

How can I get the Facebook SDK to register events on Android when the Native app is not installed on the users device, like it works in iOS? 当未在用户设备上安装本机应用程序时(如在iOS中工作),如何获取Facebook SDK在Android上注册事件? Many thanks and TIA! 非常感谢和TIA!

Basically, when you log an app event, you need to tell FB something about your app (otherwise the event will never get attributed to your app). 基本上,当您记录一个应用程序事件时,您需要告诉FB有关您应用程序的一些信息(否则该事件将永远不会归因于您的应用程序)。 If you don't have a Session, then you'll need either an app ID (at the very least), or a client token. 如果您没有会话,则需要一个应用程序ID(至少)或一个客户端令牌。

For app ID, you can either have it in your AndroidManifest.xml and strings.xml, or you can call Settings.setApplicationID() directly. 对于应用程序ID,您可以将其包含在AndroidManifest.xml和strings.xml中,也可以直接调用Settings.setApplicationID()。

For client token, you can similarly call Settings.setClientToken(). 对于客户端令牌,您可以类似地调用Settings.setClientToken()。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装了Facebook本机应用程序后,服务器端Facebook登录是否无法在“ cordova android应用程序”上运行? - Server-side Facebook login stops working on a “cordova android app” when facebook native app is installed? 如果安装了本地Facebook应用,则无法使用Facebook集成 - Facebook integration in not working if native facebook app is installed android Ionic 4:安装本机 facebook 应用程序时,使用 android 登录 facebook 失败 - Ionic 4: failed facebook login with android when the native facebook app is installed phonegap-facebook-plugin:仅在未安装本机FB应用程序时有效(Android) - phonegap-facebook-plugin: only works when native FB app is not installed (Android) Android上的Facebook Unity SDK - 安装FB App时登录失败 - Facebook Unity SDK on Android - Login fails when FB App installed Phonegap Facebook插件:安装本机FB应用程序时不起作用 - Phonegap facebook plugin: Not working when native FB app is installed 当Facebook应用程序已经安装时,Facebook在android中的集成无效 - Facebook integration in android is not working when Facebook app is already installed Android Facebook登录无法与安装的本机Facebook一起使用 - android facebook login is not working with native facebook installed 如果安装了 Native Facebook 应用,则无法使用 SDK 登录 Facebook - Can't login to Facebook using SDK if Native Facebook app is installed Android中的Facebook集成可与本机应用程序一起使用,但不适用于FB Web视图(未安装本机应用程序) - Facebook integration in android works with Native app but not working with FB Web View ( NATIVE APP NOT INSTALLED )
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM