[TIMOB-4737] Tooling: Allow substitution parameters for Android package name
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-08-29T13:28:20.000+0000 |
Affected Version/s | Release 1.7.2 |
Fix Version/s | Sprint 2011-34, Release 1.8.0 |
Components | Tooling |
Labels | n/a |
Reporter | Jeff English |
Assignee | Bill Dawson |
Created | 2011-07-20T17:07:07.000+0000 |
Updated | 2014-06-19T12:46:13.000+0000 |
Description
Enhance the build tools for android so that substitution parameters can be applied in the timodule.xml. The timodule.xml file contains manifest information that gets inserted into the android.manifest file during the build process. The Urban Airship module, for example, requires that the package name be set as part of the category name. Currently the user must update the timodule.xml with the package name, but it should be possible to automate this by allowing the specification of substitution parameters (for example, __PACKAGE_NAME__) so that the build process replaces __PACKAGE_NAME__ with the name of the package.
Example:
<manifest>
<application>
<!-- REQUIRED for C2DM and Hybrid -->
<receiver android:name="com.urbanairship.push.c2dm.C2DMPushReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="__PACKAGE_NAME__" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="__PACKAGE_NAME__" />
</intent-filter>
</receiver>
</application>
<!-- REQUIRED for C2DM -->
<!-- Only this application can receive the messages and registration result -->
<permission android:name="__PACKAGE_NAME__.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="__PACKAGE_NAME__.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive messages -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
</manifest>
When built would be inserted into the android.manifest file as
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appcelerator.urbanairshiptest"
android:versionCode="1"
android:versionName="1"
>
...
<permission android:name="com.appcelerator.urbanairshiptest.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
...
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.appcelerator.urbanairshiptest"/>
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.appcelerator.urbanairshiptest"/>
</intent-filter>
...
<uses-permission android:name="com.appcelerator.urbanairshiptest.permission.C2D_MESSAGE"/>
Attachments
File | Date | Size |
---|---|---|
ti.bogus-android-0.1.zip | 2011-08-22T13:28:22.000+0000 | 12361 |
Use the ${...} notation instead of the notation shown in the initial example
Bogus titanium module to use for testing
Testing Notes: * Create a titanium project. * Dump the attached module zip into its root folder. * Build the project. * Open
modules/android/ti.bogus/0.1/timodule.xml
just so you can see what I put in there. You'll notice the mako (template engine) tokens in a few places, namely in the attribute values for thebogus
andbogus2
elements. The idea here is that the token${tiapp.properties\['id\]}
will be replaced with the id of the app you create. * Now openbuild/android/AndroidManifest.xml
and look for thosebogus
andbogus2
elements. Also make sure that theandroid.permission.DEVICE_POWER
permission is in the AndroidManifest.xml. Because I touched that area of code, I want to be sure permissions still get in there correctly.Pull request ready: https://github.com/appcelerator/titanium_mobile/pull/403