Ours
Ours

Reputation: 392

Android - How to get library context?

I'm working on an Android application that is based on a library, and trying to implement a smart C2DM service.

However, on registration, I need to use my library package name instead of the app package name. It works fine for receiving messages, but not for registration.

Looking a bit deeper, I noticed the register method. It of courses uses a context to get registrationIntent. My problem is that this context returns the app package name, and not the library package name. I want to use this one.

So... Is there anyway to get a context from the library, that would include a package name corresponding to the lib manifest? Or, maybe is there a way to manually set the calling intent package name to my lib package?

Thanks for any answer or clue :)

Edit : I tried with the "createPackageContext" using my appPackageName as a parameter, but of course, it is not found by the system and I got an exception...

Upvotes: 1

Views: 1048

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006584

However, on registration, I need to use my library package name instead of the app package name

Libraries do not have package names.

Is there anyway to get a context from the library, that would include a package name corresponding to the lib manifest?

Libraries do not have contexts.

Upvotes: 1

Related Questions