CustomActivity extended CoronaActivity can't be called from local notification.

I called system.scheduleNotification() and notified message to status bar.

When android starts activity form status bar by touching notification, app clashed.

Logcat said

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

My main activity extended CoronaActivity.

I understood It made this problem.

Can I specify the activity called from StatusBarBroadcastReceiver?

You must have the following declared in your AndroidManifest.xml inside the <application> element.

\<receiver android:name="com.ansca.corona.notifications.StatusBarBroadcastReceiver" /\>

I already wrote it and it is not working.

Like this

<provider android:name=“com.ansca.corona.storage.FileContentProvider”

         android:authorities=“jp.co.amutus.chariso3rdrace.files”

         android:exported=“true” />

<service android:name=“com.ansca.corona.CoronaService” />

<receiver android:name=“com.ansca.corona.SystemStartupBroadcastReceiver”>

<intent-filter>

<action android:name=“android.intent.action.BOOT_COMPLETED” />

</intent-filter>

</receiver>

<receiver android:name=“com.ansca.corona.notifications.AlarmManagerBroadcastReceiver” />

<receiver android:name=“com.ansca.corona.notifications.StatusBarBroadcastReceiver” />

<receiver android:name=“com.ansca.corona.notifications.GoogleCloudMessagingBroadcastReceiver”

         android:permission=“com.google.android.c2dm.permission.SEND” >

<intent-filter>

<action android:name=“com.google.android.c2dm.intent.RECEIVE” />

<action android:name=“com.google.android.c2dm.intent.REGISTRATION” />

<category android:name=“my.package.name” />

</intent-filter>

</receiver>

<receiver android:name=“com.ansca.corona.purchasing.GoogleStoreBroadcastReceiver”>

<intent-filter>

<action android:name=“com.android.vending.billing.IN_APP_NOTIFY” />

<action android:name=“com.android.vending.billing.RESPONSE_CODE” />

<action android:name=“com.android.vending.billing.PURCHASE_STATE_CHANGED” />

</intent-filter>

</receiver>

Which version of Corona Enterprise are you using?

I am using CoronaEnterprise.2014.2401.

When I declared launcher activity like below:

<activity android:name=“com.ansca.corona.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>

</activity>

works fine.

But declared my custom activity extended com.ansca.corona.CoronaActivity like below:

<activity android:name=“my.package.name.MyActivity”          <============== changed here!

         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>

</activity>

App crashed…

All corona apps must have “com.ansca.corona.CoronaActivity” declared.

It shouldn’t be changed.

I’d assume you need to add your own custom activities without modifying the “built-in” activities.

toshioka,

Unfortunately, this is the expected behavior.  When you tap on a notification, Corona by default will attempt to display a CoronaActivity instance.  Our internal notification handling code is unaware of any derived versions of the CoronaActivity class.  If you search our Corona Enterprise forum, you can see we warn developers of this.  Plus, we can’t simple launch the main activity because we have no idea how it will handle the notification (if at all).  So, my advice is to avoid deriving from the CoronaActivity class you absolutely need to, because by doing so, you’ll have to accept some limitations such as this.

Thank you all.

You must have the following declared in your AndroidManifest.xml inside the <application> element.

\<receiver android:name="com.ansca.corona.notifications.StatusBarBroadcastReceiver" /\>

I already wrote it and it is not working.

Like this

<provider android:name=“com.ansca.corona.storage.FileContentProvider”

         android:authorities=“jp.co.amutus.chariso3rdrace.files”

         android:exported=“true” />

<service android:name=“com.ansca.corona.CoronaService” />

<receiver android:name=“com.ansca.corona.SystemStartupBroadcastReceiver”>

<intent-filter>

<action android:name=“android.intent.action.BOOT_COMPLETED” />

</intent-filter>

</receiver>

<receiver android:name=“com.ansca.corona.notifications.AlarmManagerBroadcastReceiver” />

<receiver android:name=“com.ansca.corona.notifications.StatusBarBroadcastReceiver” />

<receiver android:name=“com.ansca.corona.notifications.GoogleCloudMessagingBroadcastReceiver”

         android:permission=“com.google.android.c2dm.permission.SEND” >

<intent-filter>

<action android:name=“com.google.android.c2dm.intent.RECEIVE” />

<action android:name=“com.google.android.c2dm.intent.REGISTRATION” />

<category android:name=“my.package.name” />

</intent-filter>

</receiver>

<receiver android:name=“com.ansca.corona.purchasing.GoogleStoreBroadcastReceiver”>

<intent-filter>

<action android:name=“com.android.vending.billing.IN_APP_NOTIFY” />

<action android:name=“com.android.vending.billing.RESPONSE_CODE” />

<action android:name=“com.android.vending.billing.PURCHASE_STATE_CHANGED” />

</intent-filter>

</receiver>

Which version of Corona Enterprise are you using?

I am using CoronaEnterprise.2014.2401.

When I declared launcher activity like below:

<activity android:name=“com.ansca.corona.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>

</activity>

works fine.

But declared my custom activity extended com.ansca.corona.CoronaActivity like below:

<activity android:name=“my.package.name.MyActivity”          <============== changed here!

         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>

</activity>

App crashed…

All corona apps must have “com.ansca.corona.CoronaActivity” declared.

It shouldn’t be changed.

I’d assume you need to add your own custom activities without modifying the “built-in” activities.

toshioka,

Unfortunately, this is the expected behavior.  When you tap on a notification, Corona by default will attempt to display a CoronaActivity instance.  Our internal notification handling code is unaware of any derived versions of the CoronaActivity class.  If you search our Corona Enterprise forum, you can see we warn developers of this.  Plus, we can’t simple launch the main activity because we have no idea how it will handle the notification (if at all).  So, my advice is to avoid deriving from the CoronaActivity class you absolutely need to, because by doing so, you’ll have to accept some limitations such as this.

Thank you all.