altosdroid: Adjust build system for GMaps & Tabs support
authorMike Beattie <mike@ethernal.org>
Thu, 7 Mar 2013 06:23:39 +0000 (19:23 +1300)
committerMike Beattie <mike@ethernal.org>
Thu, 7 Mar 2013 06:23:39 +0000 (19:23 +1300)
* Use SupportV4 library for Tab support
* Use Google Services Lib for Google Maps
* revert to a standard Android target, not Google API's
* Add permissions required for Google Maps to manifest, and API key

Signed-off-by: Mike Beattie <mike@ethernal.org>
altosdroid/.classpath
altosdroid/.gitignore
altosdroid/AndroidManifest.xml
altosdroid/Makefile.am
altosdroid/project.properties

index 0ca188f976cb1ad5ecb928955d6393cf283d7a0d..fce248e6a6bf25602288b07adcc6fcab5aeb80d7 100644 (file)
@@ -1,8 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="gen"/>
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry kind="lib" path="libs/android-support-v4.jar"/>
+       <classpathentry kind="lib" path="libs/altoslib_1.jar"/>
        <classpathentry kind="output" path="bin/classes"/>
 </classpath>
index 0d2ee6e0b5c12d6212c25ddd28db36a7eea586ff..56d0776dcb42533b8362e284f195a68db3d8a751 100644 (file)
@@ -2,4 +2,5 @@ local.properties
 bin
 gen
 libs
+google-play-services_lib
 src/org/altusmetrum/AltosDroid/BuildInfo.java
index adcfe94f2c8fe48c81be62f58aa94d3e73f47729..237c6dcf40e1dbf01498337c169709233cbd8cff 100644 (file)
           android:versionCode="1"
           android:versionName="1.1.9.3">
     <uses-sdk android:targetSdkVersion="10" android:minSdkVersion="10"/>
+    <!-- Google Maps -->
+    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
+
+    <!-- Permissions needed to access bluetooth -->
     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     <uses-permission android:name="android.permission.BLUETOOTH" />
+    <!-- Permissions needed to save Telemetry logs to SD card -->
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <!-- Permissions needed for GoogleMaps -->
+    <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+
+    <permission android:name="org.altusmetrum.AltosDroid.permission.MAPS_RECEIVE"
+                android:protectionLevel="signature"/>
+    <uses-permission android:name="org.altusmetrum.AltosDroid.permission.MAPS_RECEIVE"/>
+
 
     <application android:label="@string/app_name"
                  android:icon="@drawable/app_icon"
@@ -42,5 +57,7 @@
 
         <service android:name=".TelemetryService" />
 
+        <meta-data android:name="com.google.android.maps.v2.API_KEY"
+                   android:value="AIzaSyDSr6u4i9TJmVGhgGk4g0wUUhTy9FGyn0s"/>
     </application>
 </manifest>
index 9ca2453177642b34004b34ac9caf128d43495e7c..daa649631ce8b8e9757e7b1f2c3e163aaf1d3642 100644 (file)
@@ -1,12 +1,11 @@
 if ANDROID
-all_target=bin/AltosDroid-debug.apk bin/AltosDroid-release.apk
-clean_command=ant clean
+all_target=bin/AltosDroid-debug.apk bin/AltosDroid-release-unsigned.apk
 else
 all_target=
-clean_command=echo done
 endif
 
 SDK=$(ANDROID_SDK)
+SDK_TARGET=$(shell sed -ne 's/^target=//p' project.properties)
 
 DX=$(SDK)/platform-tools/dx
 ADB=$(SDK)/platform-tools/adb
@@ -21,6 +20,14 @@ ALTOSLIB_JAR=altoslib_$(ALTOSLIB_VERSION).jar
 
 ALTOSLIB=$(EXT_LIBDIR)/$(ALTOSLIB_JAR)
 
+SUPPORT_V4_SRCDIR=$(SDK)/extras/android/support/v4
+SUPPORT_V4_JAR=android-support-v4.jar
+
+SUPPORT_V4=$(EXT_LIBDIR)/$(SUPPORT_V4_JAR)
+
+GOOGLE_PLAY_SERVICES_LIB_SRCDIR=$(SDK)/extras/google/google_play_services/libproject
+GOOGLE_PLAY_SERVICES_LIB=google-play-services_lib
+
 SRC=$(SRC_DIR)/*.java
 
 all: $(all_target)
@@ -31,6 +38,13 @@ $(EXT_LIBDIR):
 $(ALTOSLIB): $(EXT_LIBDIR) $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)
        cd $(EXT_LIBDIR) && ln -sf $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) .
 
+$(SUPPORT_V4): $(EXT_LIBDIR) $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR)
+       cd $(EXT_LIBDIR) && ln -sf $(SUPPORT_V4_SRCDIR)/$(SUPPORT_V4_JAR) .
+
+$(GOOGLE_PLAY_SERVICES_LIB): $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB)
+       cp -a $(GOOGLE_PLAY_SERVICES_LIB_SRCDIR)/$(GOOGLE_PLAY_SERVICES_LIB) .
+       cd $(GOOGLE_PLAY_SERVICES_LIB) && $(SDK)/tools/android update project --target $(SDK_TARGET) --path .
+
 $(SRC_DIR)/BuildInfo.java: $(SRC)
        ./buildinfo.sh
 
@@ -41,10 +55,10 @@ install-release: bin/AltosDroid-release.apk
 install-debug: bin/AltosDroid-debug.apk
        $(ADB) install -r bin/AltosDroid-debug.apk
 
-bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB)
+bin/AltosDroid-debug.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
        ant debug
 
-bin/AltosDroid-release.apk: $(SRC) $(ALTOSLIB)
+bin/AltosDroid-release-unsigned.apk: $(SRC) $(ALTOSLIB) $(SUPPORT_V4) $(GOOGLE_PLAY_SERVICES_LIB)
        ant release
 
 sign:
@@ -55,11 +69,14 @@ sign:
           bin/AltosDroid-release-signed.apk \
           bin/AltosDroid-release.apk
 
-endif
+clean: $(GOOGLE_PLAY_SERVICES_LIB)
+       ant clean
+       rm -rf $(EXT_LIBDIR)
+       rm -rf $(GOOGLE_PLAY_SERVICES_LIB)
 
-clean: clean-local
-       $(clean_command)
+else
 
-clean-local:
-       rm -rf $(EXT_LIBDIR)
+clean:
+
+endif
 
index 0a80e6441afd15821b54b0dd2a7affab4251c681..96b9551ce02b63037f437646af32581a9c4e5a5a 100644 (file)
@@ -8,4 +8,5 @@
 # project structure.
 
 # Project target.
-target=Google Inc.:Google APIs:10
+target=android-10
+android.library.reference.1=google-play-services_lib/