Log in or register to post comments

Activities in v1.0.6

August 11, 2011 - 8:30am #1


It looks like single QCARUnityPlayer.PlayerActivity (from v1.0.0) has been replaced by three activities (in v1.0.6):
* com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity
* com.qualcomm.QCARUnityPlayer.QCARPlayerActivity
* com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity

Previously when I wanted to extend QCAR activity all I had to do was:
1) Extend QCARUnityPlayer.PlayerActivity in my class
2) Replace QCARUnityPlayer.PlayerActivity in AndroidManifest.xml

Now with 3 activities in place it's a bit unclear what should be done. I did the old procedure to QCARPlayerProxyActivity, but it doesn't work as expected - I don't get onResume calls anymore.

Could you explain how new activities are organized? (my knowledge of activities is not perfect...) And how to extend QCAR activity?


Re: Activities in v1.0.6

August 11, 2011 - 12:20pm #2

Start by taking a look at the code Unity provides. There is a sample implementation of UnityPlayerProxyActivity located in Unity's PlaybackEngines/AndroidPlayer/src/com/unity3d/player folder. Note that this is specific to Unity 3.4, I highly recommend upgrading if you wish to override our activities.

We now provide two Java activities:

  • com.qualcomm.QCARUnityPlayer.QCARPlayerActivity extends Activity and is fashioned after UnityPlayerActivity
  • com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity extends NativeActivity and is fashioned after UnityPlayerNativeActivity

You can extend either of our classes and override the onCreate, onPause, onResume, and onDestroy methods. Be sure to call super in each case.

Then, create your own ProxyActivity (don't extend ours) by starting with the code Unity provides. Be sure to use your class names instead of com.unity3d.player.UnityPlayerActivity and com.unity3d.player.UnityPlayerNativeActivity.

Finally, update the AndroidManifest file to use your class names.

- Kim

Log in or register to post comments