How/Can I override onActivityResult ?

Hmm, 
There seems to be a big issue here : one of the SDK’s method yield this error message : Can’t create handler inside thread that has not called Looper.prepare()
 

I looked it up and it seems the error comes from the fact that something the sdk is trying to do requires it to be run on main thread.

Is this something that possible to be implemented?

ah nvm, you can actually use runonUIThread method from CoronaActivity :slight_smile:

Well, it seems there’s no way around it since looks like I need to subclass CoronaActivity. The 3rd party SDK requires me to initiate everything when the activity is created (onCreate) and override some callbacks.
Unless there’s a way to get around this, I like to hear it.

Darune, you mentioned some features won’t work. Can you tell me what are they according to your experience? For now, push notification isn’t what I desperately need so that’s okay.

As fas as I am concern I didn’t notice any other issue, but that doesn’t mean that there are none… 

My game has been one year in production and no crash log reported 

Good luck 

Yanuar, are you sure that you need to initialize the 3rd party library in the onCreate() method?

Because in my experience, it’s not required.  I know that most 3rd party libraries’ sample code put their initialize code their, but that’s merely out of convenience.  You can defer the initialize to just a bit later, such as via the CoronaRuntimeLister.onLoaded() callback which gets called just before your “main.lua” gets executed…

   http://docs.coronalabs.com/native/android/html/com/ansca/corona/CoronaRuntimeListener.html

Have a look at the “SimpleLuaExtension” sample project included with Corona Enterprise.  It shows you how to listen for Corona runtime events.  It’s a much easier approach compared to deriving from the CoronaActivity class.  Plus, you may run into some limitations with deriving from the CoronaActivity class.  The biggest one that I can think of is that tapping push notifications on the status bar is hard coded to launch the CoronaActivity class and not your derived version.  There might be other issues that I’m not aware of either, but that’s the biggest gotcha that I can think of.

Hi Joshua,

I discussed this with the 3rd party support and yes I aware that I can initiate it somewhere else. The problem is : it still require me to override the onPause and onResume to add their specific code on those events.So I really not sure how I can do that without overriding the CoronaActivity.

 

The CoronaRuntimeLister class’ onSuspended() and onResumed() get called when the activity is paused and resumed.  So, you can use those.  Just be aware that they’re called on Corona’s runtime thread and not the main UI thread.

If you look at our “Ad” app template for Android, you can see that we override those above methods as well.  This is where the ad plugin provider would stop/resume fetching ads from their servers.

Hmm, 
There seems to be a big issue here : one of the SDK’s method yield this error message : Can’t create handler inside thread that has not called Looper.prepare()
 

I looked it up and it seems the error comes from the fact that something the sdk is trying to do requires it to be run on main thread.

Is this something that possible to be implemented?

ah nvm, you can actually use runonUIThread method from CoronaActivity :slight_smile: