Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-5076

Android: update timodule.xml documentation to explain token substitutions

    Details

      Description

      (The wiki page that needs updating is: https://wiki.appcelerator.org/display/guides/tiapp.xml+and+timodule.xml+Reference ).

      Module developers can now include tokens in their timodule.xml file's <android><manifest> section. These tokens will be replaced with real values from an app's tiapp.xml when building an app that includes the module. For example, if the module includes a new android <permission>, the android:name of that permission may require the app id of the application using the module, which of course the module developer cannot know beforehand. So with this new tokening feature, the module developer can put a token in which will be replaced when the application is built.

      E.g.,

      timodule.xml

      <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
          <permission android:name="${tiapp.properties['id']}.permission.MY_NEW_PERMISSION"
      		android:protectionLevel="signature" />
        </manifest>
      </android>
      

      As you can see, the token looks like:

      ${tiapp.properties['id']}
      

      So in that example, tiapp.properties refers to a collection of all of the top-level element names you always find in tiapp.xml, such as <id>, <name>, <version>, <publisher> etc. To access a member of the collection – like we've done in the example with "id" – use square brackets with the property name in quotes inside.

      When an app with id "com.appcelerator.bogus" which contains the module is built using the above example, the app's AndroidManifest.xml will end up with a ...

      <permission android:name="com.appcelerator.bogus.permission.MY_NEW_PERMISSION"
      		android:protectionLevel="signature" />
      

      ... in it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ingo Ingo Muschenetz
                Reporter:
                billdawson Bill Dawson
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-4303
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration