Troubleshooting

I see a BatchBridge.framework.zip.h in my Xcode project, and the file seems to be missing

This is a temporary file that Batch needs to automatically integrate with your generated Xcode project.

It is harmless to see it in your project, even if Xcode shows it in red.

Integrating Batch creates compilation errors in the exported Xcode project

These errors can be caused by a bad integration. Please remove any trace of Batch (also search in the Editor and Plugins folders) and try importing Batch's package again. Then, export the Xcode project by replacing it, rather than appending.

Application crashes when launched or Batch calls do not seem to work on Android

Please make sure that you are using the latest Android SDK (Unity should use the latest SDK version it finds).

You can also check that your AndroidManifest.xml correctly references com.batch.android.unity.BatchPlayerActivity as the main activity, and not com.unity3d.player.UnityPlayerActivity.

You cannot use BatchPlayerActivity because you are using a SDK that already provides a custom activity

If you cannot extend the com.batch.android.unity.BatchPlayerActivity, you will need to manually implement Batch. In order to do so, you will need Eclipse with the ADT plugin.

  1. Open your Unity project.
  2. In the Android build settings, check Google Android Project.
  3. Click "Export" and save the project.
  4. Open Eclipse, open the File menu, click Import and select Existing Android Code into workspace.
  5. For the root directory box, pick the folder that Unity created. Uncheck projects that are not yours (libraries that you use may be displayed) and click Finish.

Your Unity project should now be imported in Eclipse. Now, we need to integrate Batch.

  1. Create a class in the package that contains UnityPlayerActivity.java. You can name it whatever you want, but it needs to extend the activity class that your other SDKs asks you to use.
  2. Implement the lifecycle methods like this and also be careful about the order of the calls around super:
import com.unity3d.player.UnityPlayerActivity;
import android.content.Intent;

public class YourCustomNativeActivity extends UnityPlayerActivity
{

	@Override
    protected void onStart()
    {
        super.onStart();
        BatchUnity.start(this);
    }

    @Override
    protected void onStop()
    {
        BatchUnity.stop(this);
        super.onStop();
    }

    @Override
    protected void onDestroy()
    {
        BatchUnity.destroy(this);
        super.onDestroy();
    }

    @Override
    protected void onNewIntent(Intent intent)
    {
        BatchUnity.onNewIntent(this, intent);
        super.onNewIntent(intent);
    }

}

Then, in both the AndroidManifest.xml of your Unity project and the one in your eclipse project, change the activity class to the one you just created. Finally, build and run your application just like any other Android project.