Notification Activity Error

Cody04l

Member
Licensed User
Longtime User
Hello,

EDIT: I realized I may have put this in the wrong forum section. Please move as needed...

So far I'm loving B4A, I have a question regarding a notification activity. I'm trying to call an activity outside my application when the notification is clicked. It appears the notification will only allow an activity inside my app to run. Is this correct? Is there a way around it?

My code to create the notification
B4X:
n.Initialize
n.Icon = "nook"
n.SetInfo("Title", "Description", "com.bn.ereader.app.ui.DashboardActivity")
n.Notify(1)

Adb error
E/B4A (11136): java.lang.ClassNotFoundException: com.blah.com.bn/com.bn.ereader.app.ui.dashboardactivity

Appreciate any help.


Thanks,
Cody
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Actually this is the correct forum section...

You can pass an intent instead of an activity.
For example the following code will start Gmail app:
B4X:
Dim n As Notification
n.Initialize
n.Icon = "icon"
Dim i As Intent
i.Initialize("", "")
i.SetComponent("com.google.android.gm/com.google.android.gm.ConversationListActivity")
n.SetInfo("Title", "Description", i)
n.Notify(1)

Note that you should write the full component name (package name / activity).
 
Upvote 0

Cody04l

Member
Licensed User
Longtime User
Erel,

Thanks for the quick response. That totally makes sense. I'll give that a shot and report back.

Thanks,
Cody

Sent from my SGH-T989 using Tapatalk
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…