I am implementing gcm notifications in my application. Because I use my code to generate lot of application with different package names I cannot use standard mypackage.GCMI
Because I use my code to generate lot of application with different package names I cannot use standard mypackage.GCMIntentService name.
I'm not sure whether you ask for a runtime or a build time solution. The other answers are runtime solutions so I thought I add some information on possibilites during build time.
In AndroidManifest, you can use the variable $PACKAGE_NAME
(available by default) which will refer to the package name you specified in the attribute package
in the manifest
root element.
The value of this package
attribute needs not be a hard coded string but can also be set dynamically via resource reference like so:
...
...
Note .service
is just a subpackage that I included to show how you specify these. Of course, this solution would work only if your applications follow general rules like putting Service classes in a .service
subpackage.
Also note, that you can actually leave the root package off completely. It will be expanded by Android:
...
...
In effect, same as above.
If you are looking for a more flexible way to replace values in an AndroidManifest (or different files), you might want to have a look at the Ant Replace task (http://ant.apache.org/manual/Tasks/replace.html) or Resource Filtering (http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html) with Maven.