commonly used sdks - fancyfsz/FancyWiki GitHub Wiki

目标:介绍Unity手游开发中通常会接入的SDK

一般还有这些相关信息:官网地址、下载链接、开发小技巧和遇到的坑点。

AppsFlyer is a SaaS mobile marketing analytics and attribution platform.

下载链接
文档
启用并检查调试日志
遇到的问题:即使设置了SetIsDebug为true, 在苹果的控制台还是看不见AppsFlyerSDK里面的日志。
解决方案 Native AppsFlyer logs were showing up in XCode but not in Console.app. In my case the problem was that I needed to activate "Include Info Messages" and "Include Debug Messages" in the "Action" menu of Console.app
CV值指的是ConversionValue AF_CV

  1. SKAdNetwork (SKAN)

需要在Facebook开发者后台创建应用;导入插件到Unity在这里不再赘述。

配置从Unity的Facebook\Edit Settings里面点开填写,App NameApp Id都很好填,和Facebook后台创建的应用对应上就行(应用的基本信息页签下),重点是Client Token(应该填的是应用的高级信息页签下的值)

Android app的SHA1值的填写,如果Google Play Console开启了签名保护机制,则你需要填写的是App signing key certificate里面的SHA-1 certificate fingerprint,而不是Upload key certificate里面的SHA-1 certificate fingerprint。这个值可以在Google Play Console的Setup/App Signing页签下查看。 实时测试事件埋点,在Firebase Console的Analytics页签下的DebugView里面可以看。

Android开启设备调试

adb shell setprop debug.firebase.analytics.app [your applicationId]
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

Android关闭设备调试

adb shell setprop debug.firebase.analytics.app .none.

这里的GoogleSignIn插件指得是Google邮箱登陆,这个github仓库已经不再维护,不过从功能上来讲已经足够用了。导入插件的时候Parse不用勾选,否则会跟unity自带的库有冲突,到时候还得删。需要的WebClientID参数是在Google Cloud Project(后面简称GCP吧)里面配置的,需要创建Web类型的Oauth2客户端。这个云项目需要在设置Google Play Game Service Project的时候Link Cloud Project那一步关联起来。在GCP中的用户同意屏幕的配置里面去添加Testers,这里的Testers可以测试开发阶段的App的Google邮箱登陆功能。

将Play Games Services SDK加到App里面并上传到Google Play Console之后,Play Games Services configuration的Add the Play Games Services SDK to your APK to use the APIs就会变Add the Play Games Services SDK to your APK to use the APIs表示该步骤已完成。Create credentials这个步骤的凭证添加是选择关联的GCP后台的credentials,Android类型的和Web类型的都加一下。Add testers to your project这个步骤添加的Testers可以测试开发阶段App的GooglePlay登陆功能以及其他Google Play服务相关的功能,比如成就。

Your app uses a third-party login service, but does not offer Sign in with Apple. Apps that use a third-party login service for account authentication need to offer Sign in with Apple to users as an equivalent option to provide the sign-in experience App Store users expect.

注意如果App需要在Apple Store上架并提供了第三方的登陆服务,则按照Guideline 4.8 - Design - Sign in with Apple的要求必须也提供AppId的登陆方式。

Google 移动广告 SDK 有时会在与 Unity 主线程不同的线程上引发事件。在与从 Google 移动广告 SDK 分派的事件中的 Unity 对象互动时,这可能会导致问题。如需解决此问题,您可能需要添加代码,以将移动广告 SDK 事件与 Unity 主线程同步。如果您希望移动广告 SDK 为您处理此线程问题,请将 MobileAds.RaiseAdEventsOnUnityMainThread 设置为 true。这会强制移动广告 SDK 引发 Unity 主线程上的所有事件和回调。

// 在 Unity 主线程上引发广告事件
using GoogleMobileAds.Api;
public class GoogleMobileAdsDemoScript : MonoBehaviour
{
    public void Start()
    {
        // When true all events raised by GoogleMobileAds will be raised
        // on the Unity main thread. The default value is false.
        MobileAds.RaiseAdEventsOnUnityMainThread = true;
    }
}

可见如果不设置RaiseAdEventsOnUnityMainThread为true,它的默认值则是false,就不能保证事件是在Unity的主线程进行处理的。因此就可能遇到以下的报错:other thread is trapped; signum = 11和Application uncaught exception in thread "main"从而造成应用崩溃。

⚠️ **GitHub.com Fallback** ⚠️