Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14899] Tooling: Include Google Maps V2 metadata into timodule.xml so can be added to the manifest with the correct app id.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-11-06T22:02:04.000+0000
Affected Version/sRelease 3.1.2
Fix Version/s2013 Sprint 23, 2013 Sprint 23 API, Release 3.2.0
ComponentsAndroid
LabelssupportTeam
ReporterEduardo Gomez
AssigneeHieu Pham
Created2013-08-16T18:58:53.000+0000
Updated2013-12-18T23:18:36.000+0000

Description

Feature Request

To add ability to have the application name automatically updated in the timodule.xml file when building an application.

Rationale

Forgive me if I'm missing something obvious. The problem is that if they use the included module they have to assume it will be upgraded and replaced when a new Titanium SDK is released. Since the module will be replaced they cannot use the timodule.xml file to add the app id to the required permissions for the maps module. We have to add the permissions below to the tiapp.xml file.
<uses-permission android:name="${tiapp.properties['id']}.permission.MAPS_RECEIVE"/>   <permission android:name="${tiapp.properties['id']}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
When we add them like that to the tiapp.xml file we get errors like:
[TRACE] Writing out AndroidManifest.xml
[DEBUG] /Users/egomez/android-sdks/build-tools/17.0.0/aapt package -m -J "/Users/egomez/Documents/Titanium Studio Workspace/TravisTestApp/build/android/gen" -M "/Users/egomez/Documents/Titanium Studio Workspace/TravisTestApp/build/android/AndroidManifest.xml" -S "/Users/egomez/Documents/Titanium Studio Workspace/TravisTestApp/build/android/res" -I /Users/egomez/android-sdks/platforms/android-10/android.jar
[ERROR] /Users/egomez/Documents/Titanium Studio Workspace/TravisTestApp/build/android/AndroidManifest.xml:4: Tag <permission> attribute name has invalid character '$'.
[ERROR] /Users/egomez/Documents/Titanium Studio Workspace/TravisTestApp/build/android/AndroidManifest.xml:39: Tag <uses-permission> attribute name has invalid character '$'.
[ERROR] Error generating R.java from manifest

Steps to reproduce

Do a project clean, and build the android app and the map did not load. We then checked the generated AndroidManifest.xml file and looked for the required permissions that are outlined in the index.html file of the maps module. In the AndroidManifest file I found that the following permissions were present:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
The other 4 were not present in the manifest file and they need to be included for the Maps Module to work. Client would like to propose that the following be included in the timodule.xml that is included with the maps module that way they are automatically added to the manifest with the correct app id. The 4 which should be added to timodule.xml are:
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="${tiapp.properties['id']}.permission.MAPS_RECEIVE"/>
<permission android:name="${tiapp.properties['id']}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>

Additional info

Client also tested this by modifying the timodule.xml file for the module in the following directory: - "/Library/Application Support/Titanium/Modules/android/ti.map/2.1.1/" When they just added those 4 lines the maps module started working properly. Also can be confirmed that the 4 missing permissions/features are now present in the AndroidManifest.xml file.

Comments

  1. Allen Yeung 2013-08-19

    I agree that this would be convenient, but you would still need to add a node in your tiapp.xml for the Google API keys. Instead of adding these entries in timodule.xml, you can just add it in the tiapp.xml like it says in the docs http://docs.appcelerator.com/titanium/latest/#!/guide/Google_Maps_v2_for_Android-section-36739898_GoogleMapsv2forAndroid-ObtainandAddaGoogleAPIKey Can you let me know if there are any issues with adding this to the tiapp.xml instead of the timodule.xml? Normally, you shouldn't need to modify timodule.xml. Since Chris is doing a rewrite of the android build command, I think this should be done as a part of that instead of putting in another quick fix for 3.1.3.
  2. Hieu Pham 2013-11-05

    Testing steps: 1. Create a new project, only add the map v2 key to manifest (You may need to generate this). 2. Build the project with map module, all other required permissions should be automatically added. 3. Run the project with example/app.js, app should run as expected.
  3. Hieu Pham 2013-11-06

    PR: https://github.com/appcelerator-modules/ti.map/pull/19
  4. Lokesh Choudhary 2013-12-18

    Verified by running the testing steps from Hieu & the necessary permissions are automatically added when just mapv2key is present in the android manifest file. Closing. Environment: Appcel Studio : 3.2.0.201312171913 Ti SDK : 3.2.0.v20131217190633 Mac OSX : 10.8.5 Alloy : 1.3.0-cr2 CLI - 3.2.0-cr3 Samsung Galaxy S4 running android 4.2.2

JSON Source