Chartboost module help

Monkey Targets Forums/Android/Chartboost module help

Zurrr(Posted 2013) [#1]
I try to impliment Chartboost sdk but so far fail. I try to use
static function fail. Has to use dynamic method but no luck.

JAVA expert please advice. I got this runtime error when I compile to android.

"Can't create handler inside thread that has not called Looper.prepare()"

My java code:
import com.chartboost.sdk.*;

class ChartBoost extends Activity {
	
	private Chartboost cb;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		// Configure Chartboost
		this.cb = Chartboost.sharedChartboost();
		String appId = "511f3a85172345345353435";
		String appSignature = "88b9b8c701cc1f503453453453453534534";
		this.cb.onCreate(this, appId, appSignature, null);
		
		// Notify the beginning of a user session
		this.cb.startSession();
		
		// Show an interstitial
		this.cb.showInterstitial(); 
   	}
   	
	@Override
	public void onDestroy() {
		super.onDestroy();
		this.cb.onDestroy(this);
	}

	@Override
	protected void onStart() {
	    super.onStart();
	
	    this.cb.onStart(this);
	}
	
	@Override
	protected void onStop() {
	    super.onStop();
	
	    this.cb.onStop(this);
	}
	
	@Override
	public void onBackPressed() {
	
	    // If an interstitial is on screen, close it. Otherwise continue as normal.
	    if (this.cb.onBackPressed())
	        return;
	    else
	        super.onBackPressed();
	}
}


My module monkey code
Private

#If( TARGET <> "android" And TARGET <> "html5" And TARGET <> "ios" And TARGET <> "glfw" )
  #Error "ChartBoost is currently not available for target '${TARGET}'."
#End If

Import "native/ChartBoost.${TARGET}.${LANG}"

Public

Extern

Class CBoost = "ChartBoost" 
	Method onCreate:Void(savedInstanceState:Bundle)
End Class


My test monkey app:
Import mojo
Import ChartBoost

Function Main ()
	New Game
End

Class Game Extends App	
	Field ads:CBoost
	Method OnCreate ()
		ads=New CBoost
	End
	Method OnUpdate ()	
	End
	Method OnRender ()
	End	
End



pantson(Posted 2013) [#2]
I had this yesterday when I was trying to get BONO IAP working.
After I removed any calls to the module, chartboost and admob started working for me again
Hope that helps


Wagenheimer(Posted 2013) [#3]
Same problem here, but I'm not using nothing from BONO IAP.

Any idea?


pantson(Posted 2013) [#4]
I think its because you're initialising Chartboost while in Monkey
alter you java and monkey so that you have 2 funtions (not tested)

JAVA
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		// Configure Chartboost
		this.cb = Chartboost.sharedChartboost();
		String appId = "511f3a85172345345353435";
		String appSignature = "88b9b8c701cc1f503453453453453534534";
		this.cb.onCreate(this, appId, appSignature, null);
		
		// Notify the beginning of a user session
		this.cb.startSession();
		
   	}

  public void  ShowAd()  {
		// Show an interstitial
		this.cb.showInterstitial(); 
  }



michaelcontento(Posted 2013) [#5]
@pantson: Bono caused this error? Can you share some more insights? Sounds strange to me and should definitely NOT happen!

Please share as much as possible and I'll gladly fix this :)


pantson(Posted 2013) [#6]
no... I think it was a red herring.
Still trying to get bono working on v67+ and chartboost is running fine now

stand down! ;-)