[英]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.