Brefore user login, this code:
FB.Init(() =>
{
FB.PublishInstall();
});
results in an error:
03-14 10:55:01.241: I/Unity(6662): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
03-14 10:55:01.326: I/Unity(6662): Exception: java.lang.ExceptionInInitializerError
03-14 10:55:01.326: I/Unity(6662): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at UnityEngine.AndroidJNISafe.CallStaticVoidMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at UnityEngine.AndroidJavaObject.CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at Facebook.AndroidFacebook.CallFB (System.String method, System.String args) [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at Facebook.AndroidFacebook.PublishInstall (System.String appId, Facebook.FacebookDelegate callback) [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at FB.PublishInstall (Facebook.FacebookDelegate callback) [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at PublishInstallController.<PublishInstall>m__87 () [0x00000] in <filename unknown>:0
03-14 10:55:01.326: I/Unity(6662): at Facebook.AndroidFacebook.OnInitComplete
If a user is logged in before executing this code:
FB.PublishInstall();
everything goes well.
The documentation (Step 2: Add the Facebook SDK) says:
After installing the SDK, include the following code to be executed when your app is in the foreground. This will allow the app to ping back the install event to Facebook when the user opens up the app for the first time, and again in the future if there is a network error. Our client code will stop sending installs once it acquires a success code from the server, and our back-end will only count the install a single time if it receives multiple hits for the same device:
Question:
- Did I understand correctly that you can call FB.PublishInstall () before user authorization in facebook?
- Is there any possibility to fix this error?