Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

This part of the documentation extends the integration process of Appoxee's native library into the Unity3D world.

Dual Plugin Integration

If your Unity project is being developed with IDE version under 5, please note that using both of our Android & iOS plugins (or any 3rd party plugin) will cause an issue known to Unity3D users, which is described in this URL : iOS build loads assembly from Assets/Plugins/Android. Why? Build fails.

There is also mentioning of this (with an alternate solution) in Stack Overflow - Unity Plugin for both iOS and Android Failing AOT for iOS due to AndroidJavaObject

Integrating Unity Plugin will provide you with the functionality supported as part of the Appoxee SDK (iOS SDK 4.0.8 / Android 2.7.0), aside from Appoxee Inbox which is not supported as part of the Unity plugin.
Before you can start using Appoxee SDK functionality in your Unity scripts, you’ll need to import the plugin files to your Unity project as detailed on the integration instructions.

Integration Instructions : 

Phase 1
  1. Download the Appoxee Android Unity Plugin Zip file for the Download Page.
  2. Extract the zip file to path : UnityProjectName/Assets
  3. For Android Only : Replace in AndroidManifest.xml the "YOUR_PACKAGE_NAME" placeholder to your reverse-domain package name as you set in the Unity IDE
  4. Verify that this is the directory structure and content after extracting : 
    1. UnityProjectName/Assets/AppoxeePlugin/AppoxeePlugin.cs 
    2. UnityProjectName/Assets/AppoxeePlugin/IAppoxeeCallable.cs 
    3. UnityProjectName/Assets/Plugins/Android/appoxee-sdk.jar 
    4. UnityProjectName/Assets/Plugins/Android/appoxee-unity-plugin.jar 
    5. UnityProjectName/Assets/Plugins/Android/AppoxeeSDK/AndroidManifest.xml 
    6. UnityProjectName/Assets/Plugins/Android/AppoxeeSDK/project.properties 
    7. UnityProjectName/Assets/Plugins/Android/AppoxeeSDK/libs 
    8. UnityProjectName/Assets/Plugins/Android/AppoxeeSDK/res 
    9. UnityProjectName/Assets/Plugins/Android/google-play-services_lib 
    10. UnityProjectName/Assets/Plugins/ios/AppoxeePlugin.h + m
    11. UnityProjectName/Assets/Plugins/ios/AppoxeePluginDelegate.h + m
    12. UnityProjectName/Assets/Plugins/ios/UnityAppController+AppoxeeUnity.h + m
    13. UnityProjectName/Assets/Plugins/ios/AppoxeeSDK.framework

  5. Open your Unity project.
Phase 2
  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.

    SDK 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 : 

    Init AppoxeeAndroidBridge
    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");
    			unityBridge.ReportActivation();
    		}
    	}
    ...
    	//If Application is on it's way for background / out of focus, must report deactivation for analytics 
    	void OnApplicationPause(bool pauseStatus) {
            if (pauseStatus) {
                #if UNITY_ANDROID
                if (unityBridge != null) {
                    unityBridge.ReportDeactivation();
                }
                #elif
    
                #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


 



  • No labels