Repository: libgdx/libgdx
Issue: allowIpod config not working if music started after app is launched

Setting allowIpod = true in IOSApplicationConfiguration seems to have no effect if the libGDX application is launched without any music playing.

Steps to reproduce:
- start libGDX app with music off  (with allowIpod = true)
- switch to iTunes/music app
- start music
- return to libGDX app (music stops, it should keep playing)

I get the same result in iOS 6 and 7
libGDX version: 1.2.0
roboVM version 0.0.14

There is another report of the same issue on stack overflow: http://stackoverflow.com/questions/23473429/libgdx-robovm-allowipod-does-not-work-if-game-starts-then-paused


Changed files:
backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/objectal/OALSimpleAudio.java

diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
index 96f15ec53..22eb09dda 100644
--- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
+++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
@@ -1,12 +1,12 @@
 /*******************************************************************************
  * Copyright 2011 See AUTHORS file.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,6 +45,7 @@ import com.badlogic.gdx.LifecycleListener;
 import com.badlogic.gdx.Net;
 import com.badlogic.gdx.Preferences;
 import com.badlogic.gdx.backends.iosrobovm.objectal.OALAudioSession;
+import com.badlogic.gdx.backends.iosrobovm.objectal.OALSimpleAudio;
 import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Clipboard;
@@ -176,7 +177,7 @@ public class IOSApplication implements Application {
 	}
 
 	/** Returns our real display dimension based on screen orientation.
-	 * 
+	 *
 	 * @param viewController The view controller.
 	 * @return Or real display dimension. */
 	CGSize getBounds (UIViewController viewController) {
@@ -227,6 +228,9 @@ public class IOSApplication implements Application {
 		// workaround for ObjectAL crash problem
 		// see: https://groups.google.com/forum/?fromgroups=#!topic/objectal-for-iphone/ubRWltp_i1Q
 		OALAudioSession.sharedInstance().forceEndInterruption();
+		if (config.allowIpod) {
+			 OALSimpleAudio.sharedInstance().setUseHardwareIfAvailable(false);
+		}
 		graphics.makeCurrent();
 		graphics.resume();
 	}
diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/objectal/OALSimpleAudio.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/objectal/OALSimpleAudio.java
index 4824f7aae..1a048556c 100644
--- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/objectal/OALSimpleAudio.java
+++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/objectal/OALSimpleAudio.java
@@ -1,12 +1,12 @@
 /*******************************************************************************
  * Copyright 2013 See AUTHORS file.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,10 @@
 package com.badlogic.gdx.backends.iosrobovm.objectal;
 
 import org.robovm.apple.foundation.NSObject;
-import org.robovm.objc.ObjCClass;
 import org.robovm.objc.ObjCRuntime;
-import org.robovm.objc.Selector;
 import org.robovm.objc.annotation.Method;
 import org.robovm.objc.annotation.NativeClass;
 import org.robovm.objc.annotation.Property;
-import org.robovm.rt.bro.annotation.Bridge;
 import org.robovm.rt.bro.annotation.Library;
 
 /**
@@ -60,4 +57,10 @@ public final class OALSimpleAudio extends NSObject {
 
 	@Property
 	public native void setHonorSilentSwitch (boolean honorSilentSwitch);
+
+	@Property
+	public native boolean isUseHardwareIfAvailable();
+
+	@Property
+	public native void setUseHardwareIfAvailable(boolean b);
 }