Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Integration instruction change for analytics

Preface : 

...

  1. Your MainCameraScript class must implement IAppoxeeCallable in order to receive the results of the API calls.

  2. Your MainCameraScript class should hold a member of the AppoxeePlugin in order to use the different API calls after initializing it, using the Factory method.
  3. In order to initialise the Appoxee Unity Bridge, call AppoxeePlugin.CreateAppoxeeUnityBridge() , passing it your gameObject, Your SDK Key & Secret Key. Do so in your onStart() method.

    Warning
    titleSDK Key & Secret - Do Not Confuse Platforms!

     

    Make sure the Key & Secret under your iOS Application in the Appoxee Dashboard is used for your iOS Unity App.

    Make sure the Key & Secret under your Android Application in the Appoxee Dashboard is used for your Android Unity App.

    Do not mix between them!
  4. In your onStart() method, call AppoxeeReportActivate() in order to signal  to the SDK that the App is now in foreground. This is crucial for analytics.
  5. In your onDestroy() method, call AppoxeeReportBackground() in order to signal to the SDK that the App is now in background, This is crucial for analytics.
  6. Android Users - Please Note : if your AppoxeePlugin member is NULL after calling the Factory method, the appoxee-unity-plugin.jar is MISSING, thus resulting a crash on each API call.
  7. The following code snippet shows the MainCameraScript class as step 1 - 5 explain : 

    Code Block
    languagec#
    titleInit AppoxeeAndroidBridge
    linenumberstrue
    using UnityEngine;
    using System;
    ...
    public class MainCameraScript : MonoBehaviour,IAppoxeeCallable<String> {
    ...
    	private AppoxeePlugin unityBridge; //Keep as field/member in order to use the API. if Null, API calls will cause a crash in runtime.
    ...
    	void Start () {
    		if (unityBridge == null) {
    			unityBridge = AppoxeePlugin.CreateAppoxeeUnityBridge(this, "YOUR_SDK_KEY", "YOUR_SECRET_KEY");
    			#if UNITY_ANDROID
    				unityBridge.ReportActivation();
    			#endif
    		}
    	}
    ...
    	//If Application is on it's way for background / out of focus, must report deactivation for analytics 
    	void OnDestroy() {
    			 OnApplicationPause(bool pauseStatus) {
            if (pauseStatus) {
                #if UNITY_ANDROID
    				            if (unityBridge != null) {
                    unityBridge.ReportDeactivation();
                }
                #elif
    
                #endif
           			#endif
    	 }
        }
    	//If Application is in focus/back in foreground, must report activation for analytics 
        void OnApplicationFocus(bool focusStatus) {
            if (focusStatus) {
                #if UNITY_ANDROID
                if (unityBridge != null) {
                    unityBridge.ReportActivation();
                }
                #elif
    
                #endif
            }
        }
    ...
    }
  8. API Samples can be seen in the following link

...