0

I'm creating a white-labeled application. I run the project through aapt with the --rename-manifest-package option.

This allows me write com.foobar

And release

com.foobar.demo and com.foobar.extended versions to be installed on the same device.

However, even though the services are set via both permission android:permission="@string/permission_name" (which changes per install) and android:exported="false" each app wants to call the other apps services!

I.e. when I start com.foobar.extended I get a security exception about it not having permission for com.foobar.demo's service!

It appears that -rename-manifest-package doesn't change the service intent filters, so they remain com.foobar.services.X meaning that one apps services have higher priority for processing the intents.

How can I prevent this issue? (Maybe a startLocalService() which doesn't send the intents outside the application...)

Thanks,

John

johncc
  • 918
  • 1
  • 8
  • 13

1 Answers1

0

You haven't provided a copy of your manifest file, but I would guess that you have used absolute names there, whereas you should have been using relative names.

Instead of

<service android:name="com.foobar.demo.service" />

you should use

<service android:name=".service" />

(Notice that the name starts with a period).

zmarties
  • 4,809
  • 22
  • 39
  • I am using relative service names in the AndroidManifest.xml file. However when I start the service I use and Intent with a String action. I.e. "com.foobar.services.MyService". – johncc Mar 06 '14 at 10:51
  • -rename-manifest-package will not know to change the internal string you use to start a service. The reason for using a relative name in the manifest is that you can then build the name up at runtime using `context.packageName() + ".service"` – zmarties Mar 06 '14 at 12:24