Corona android app crash when return from push notification

Hi guys

I’m developing game on android using push notification on Corona.

When i click on push to return app, crash error is occurred. This is content of error:

java.lang.RuntimeException: Unable to start receiver com.ansca.corona.notifications.StatusBarBroadcastReceiver: android.content.ActivityNotFoundException: Unable to find explicit activity class {me.xxx.xxx/com.ansca.corona.CoronaActivity}; have you declared this activity in your AndroidManifest.xml? 

me.xxx.xxx is package name.

android main activity is declared in  AndroidMainifest.xml

\<!-- The main Corona activity that runs the Corona project. --\> \<activity android:name="me.xxx.xxx.CoronaActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/app\_name" android:launchMode="singleTask" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"\> \<intent-filter\> \<action android:name="android.intent.action.MAIN" /\> \<category android:name="android.intent.category.LAUNCHER" /\> \</intent-filter\> \<intent-filter\> \<action android:name="android.intent.action.VIEW"/\> \<category android:name="android.intent.category.DEFAULT" /\> \<category android:name="android.intent.category.BROWSABLE" /\> \<data android:scheme="scheme name" /\> \</intent-filter\> \</activity\>&nbsp;

My question is why the name activity of push notification is “com.ansca.corona.CoronaActivity” while i declared main activity name in AndroidManifest.xml is  me.xxx.xxx.CoronaActivity 

i can config activity name of push notification or not ? How?

Thanks!  

 

In my project i need override CoronaActivity. 

public class me.xxx.xxxCoronaActivity extends com.ansca.corona.CoronaActivity{ } 

Therefore, i setting main activity name in AndroidManifest is  me.xxx.xxx.CoronaActivity 

Are you using Enterprise?

By the way, I deleted your duplicate post.

@long,

It sounds like you are using Corona Enterprise.  Corona does *not* support displaying a CoronaActivity *derived* class when you tap on a notification in the status bar.  That’s a limitation we have on our end that there is no easy work-around for.  My advice is to avoid deriving from our CoronaActivity class if possible.

thanks for reply !!

yes, am using Corona Enterprise. 

but i have to deploy 3rd party plugins and require extend CoronaActivity with implement some interfaces of this plugin.

Not have any way to solve this problem? 

If you want to use Corona for push notifications, then you can’t derive from the CoronaActivity class.  There is no other work-around.

Are you sure you have to implement these 3rd party plugins/library via an Activity?

Odd are you don’t and we can help you with another solution.

So, what exactly do these libraries need from the activity?

If all you need is to handle the Activity.onActivityResult() method, then we provide a solution here…

   https://forums.coronalabs.com/topic/37282-how-can-one-capture-cameragallery-return-result-in-android-native-code/?p=193386

I have to implement these 3rd party plugins. 

This plugin has require implement some of individual callback interface.

Is CoronaActivity can implement that interface directly if not use class derived from the CoronaActivity?  

Can you point me to the documentation for these Java interfaces?

I might be able to offer some suggestions on how to implement them outside of the activity.

 Thanks for reply!

That is interface to get callback of 3rd party advertising plugin.(as display ad, click ad, change ad,…)

But because security reason, i can’t public here. 

you be able to offer some suggestions for me with the most common way? 

Thanks! 

If its for an ad plugin, then I’m guessing you need to know when the activity’s onPause() and onResume() gets called.  If you do, then you can infer this from our Java CoronaRuntimeListener interface.

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

It’s not quite the same and that listener’s methods will get called on another thread (not the main UI thread), but the Corona runtime’s lifecycle is tied to the activity’s lifecycle.  Meaning that when the activity is paused/stopped, the Corona runtime gets suspended.  And when the activity gets resumed, the Corona runtime gets resumed too.  Our ad plugins leverage this interface to ensure that the ad library that they’re using will stop requesting for ads while the app/activity is suspended.  You can find an example of this in “ProjectTemplates/ads-provider” that is included with Corona Enterprise.  Just go to the LuaLoader.java file.

Another example we have can be seen in “Samples/ExtendingUI” where the CoronaRuntimeListener is used outside of a plugin.  In this case, a CoronaRuntimeListener is added via an Android “Application” derived class to determine when a runtime gets loaded.  Once loaded, it’ll add custom UI to the activity.  Note that this example shows you how to a Java Runnable object to reach the main UI thread from the Corona/OpenGL thread in onLoaded().

In my project i need override CoronaActivity. 

public class me.xxx.xxxCoronaActivity extends com.ansca.corona.CoronaActivity{ } 

Therefore, i setting main activity name in AndroidManifest is  me.xxx.xxx.CoronaActivity 

Are you using Enterprise?

By the way, I deleted your duplicate post.

@long,

It sounds like you are using Corona Enterprise.  Corona does *not* support displaying a CoronaActivity *derived* class when you tap on a notification in the status bar.  That’s a limitation we have on our end that there is no easy work-around for.  My advice is to avoid deriving from our CoronaActivity class if possible.

thanks for reply !!

yes, am using Corona Enterprise. 

but i have to deploy 3rd party plugins and require extend CoronaActivity with implement some interfaces of this plugin.

Not have any way to solve this problem? 

If you want to use Corona for push notifications, then you can’t derive from the CoronaActivity class.  There is no other work-around.

Are you sure you have to implement these 3rd party plugins/library via an Activity?

Odd are you don’t and we can help you with another solution.

So, what exactly do these libraries need from the activity?

If all you need is to handle the Activity.onActivityResult() method, then we provide a solution here…

   https://forums.coronalabs.com/topic/37282-how-can-one-capture-cameragallery-return-result-in-android-native-code/?p=193386

I have to implement these 3rd party plugins. 

This plugin has require implement some of individual callback interface.

Is CoronaActivity can implement that interface directly if not use class derived from the CoronaActivity?  

Can you point me to the documentation for these Java interfaces?

I might be able to offer some suggestions on how to implement them outside of the activity.

 Thanks for reply!

That is interface to get callback of 3rd party advertising plugin.(as display ad, click ad, change ad,…)

But because security reason, i can’t public here. 

you be able to offer some suggestions for me with the most common way? 

Thanks! 

If its for an ad plugin, then I’m guessing you need to know when the activity’s onPause() and onResume() gets called.  If you do, then you can infer this from our Java CoronaRuntimeListener interface.

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

It’s not quite the same and that listener’s methods will get called on another thread (not the main UI thread), but the Corona runtime’s lifecycle is tied to the activity’s lifecycle.  Meaning that when the activity is paused/stopped, the Corona runtime gets suspended.  And when the activity gets resumed, the Corona runtime gets resumed too.  Our ad plugins leverage this interface to ensure that the ad library that they’re using will stop requesting for ads while the app/activity is suspended.  You can find an example of this in “ProjectTemplates/ads-provider” that is included with Corona Enterprise.  Just go to the LuaLoader.java file.

Another example we have can be seen in “Samples/ExtendingUI” where the CoronaRuntimeListener is used outside of a plugin.  In this case, a CoronaRuntimeListener is added via an Android “Application” derived class to determine when a runtime gets loaded.  Once loaded, it’ll add custom UI to the activity.  Note that this example shows you how to a Java Runnable object to reach the main UI thread from the Corona/OpenGL thread in onLoaded().