Office Hours Transcript: 2021-10-09

Jan joined

Hi,

hello, Jan!

 

how can I help you today, in our remaining time?

I’m trying to do an explicit intent. I’ve set ComponentName using package name string and component name as string. But it’s not getting received. Should component name be the full name of the class? I’ve tried both ways - fully qualified and only the BroadcastReceiver class name. It’s in a different package so couldn’t use the query from your blog post.

what are you calling? setClassName()? setComponent()? something else?

setComponent

OK, so you are using the ComponentName constructor that takes two strings?

yes

then the class name should be the fully-qualified class name

 

if this is simply to get past the implicit broadcast ban, try using setPackage() instead of setComponentName() – it saves you from needing the class name

 

IIRC, setPackage() makes the Intent "explicit enough" to get past the implicit broadcast ban

okay, I’ve used the fully qualified name so I know that’s not the problem. I’ll try setPackage. Thanks. Have a great week-end.

you too!

Oh, wait.

 

Do I need the <receiver> to say anything to make it explicit in manifest?

okay.

Jan left