aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-26 09:42:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-26 09:42:32 +1300
commit958366ccabaaa2768fd4030fdb7c4cfc7ba04dd2 (patch)
tree39383109363f58eba5526bba95a789371da7f66a /app
parentb28175783a747fcb54f646cdd706f443a91695dc (diff)
downloadetbsa-traccar-manager-android-958366ccabaaa2768fd4030fdb7c4cfc7ba04dd2.tar.gz
etbsa-traccar-manager-android-958366ccabaaa2768fd4030fdb7c4cfc7ba04dd2.tar.bz2
etbsa-traccar-manager-android-958366ccabaaa2768fd4030fdb7c4cfc7ba04dd2.zip
Update project SDK and API key
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle11
-rw-r--r--app/src/main/AndroidManifest.xml6
-rw-r--r--app/src/main/java/org/traccar/manager/MainActivity.java57
-rw-r--r--app/src/main/res/layout/activity_main.xml13
-rw-r--r--app/src/main/res/values/google_maps_api.xml (renamed from app/src/debug/res/values/google_maps_api.xml)2
-rw-r--r--app/src/release/res/values/google_maps_api.xml18
6 files changed, 32 insertions, 75 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 9a8ffc4..e06fb40 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 22
- buildToolsVersion "22.0.1"
+ compileSdkVersion 23
+ buildToolsVersion "23.0.1"
defaultConfig {
applicationId "org.traccar.manager"
minSdkVersion 10
- targetSdkVersion 22
+ targetSdkVersion 23
versionCode 1
versionName "1.0"
}
@@ -19,6 +19,7 @@ android {
}
dependencies {
- compile 'com.android.support:appcompat-v7:22.2.1'
- compile 'com.google.android.gms:play-services:7.5.0'
+ compile 'com.android.support:appcompat-v7:23.1.0'
+ compile 'com.google.android.gms:play-services:8.4.0'
+ compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index dc12d49..2f2c1cd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -14,11 +14,9 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
+
<meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
- <meta-data
- android:name="com.google.android.maps.v2.API_KEY"
+ android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
diff --git a/app/src/main/java/org/traccar/manager/MainActivity.java b/app/src/main/java/org/traccar/manager/MainActivity.java
index 7b6e202..68d5135 100644
--- a/app/src/main/java/org/traccar/manager/MainActivity.java
+++ b/app/src/main/java/org/traccar/manager/MainActivity.java
@@ -1,65 +1,36 @@
package org.traccar.manager;
-import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
-public class MainActivity extends FragmentActivity {
+public class MainActivity extends FragmentActivity implements OnMapReadyCallback {
- private GoogleMap mMap; // Might be null if Google Play services APK is not available.
+ private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- setUpMapIfNeeded();
+ // Obtain the SupportMapFragment and get notified when the map is ready to be used.
+ SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.map);
+ mapFragment.getMapAsync(this);
}
@Override
- protected void onResume() {
- super.onResume();
- setUpMapIfNeeded();
- }
+ public void onMapReady(GoogleMap googleMap) {
+ map = googleMap;
- /**
- * Sets up the map if it is possible to do so (i.e., the Google Play services APK is correctly
- * installed) and the map has not already been instantiated.. This will ensure that we only ever
- * call {@link #setUpMap()} once when {@link #mMap} is not null.
- * <p/>
- * If it isn't installed {@link SupportMapFragment} (and
- * {@link com.google.android.gms.maps.MapView MapView}) will show a prompt for the user to
- * install/update the Google Play services APK on their device.
- * <p/>
- * A user can return to this FragmentActivity after following the prompt and correctly
- * installing/updating/enabling the Google Play services. Since the FragmentActivity may not
- * have been completely destroyed during this process (it is likely that it would only be
- * stopped or paused), {@link #onCreate(Bundle)} may not be called again so we should call this
- * method in {@link #onResume()} to guarantee that it will be called.
- */
- private void setUpMapIfNeeded() {
- // Do a null check to confirm that we have not already instantiated the map.
- if (mMap == null) {
- // Try to obtain the map from the SupportMapFragment.
- mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
- .getMap();
- // Check if we were successful in obtaining the map.
- if (mMap != null) {
- setUpMap();
- }
- }
+ LatLng sydney = new LatLng(-34, 151);
+ map.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
+ map.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
- /**
- * This is where we can add markers or lines, add listeners or move the camera. In this case, we
- * just add a marker near Africa.
- * <p/>
- * This should only be called once and when we are sure that {@link #mMap} is not null.
- */
- private void setUpMap() {
- mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
- }
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index c036319..1e523d2 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,4 +1,9 @@
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
- android:layout_height="match_parent" android:id="@+id/map" tools:context=".MainActivity"
- android:name="com.google.android.gms.maps.SupportMapFragment" />
+<fragment
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/map"
+ android:name="com.google.android.gms.maps.SupportMapFragment"
+ tools:context=".MainActivity" />
+
diff --git a/app/src/debug/res/values/google_maps_api.xml b/app/src/main/res/values/google_maps_api.xml
index 27fc920..2c7a04f 100644
--- a/app/src/debug/res/values/google_maps_api.xml
+++ b/app/src/main/res/values/google_maps_api.xml
@@ -1,5 +1,5 @@
<resources>
- <string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">AIzaSyB2sTYAPuWFpWHCP-cbGBYL2qJVmsMnfrQ</string>
+ <string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">AIzaSyAMQYClXhA2tZdfCzu9EK9wUDWtCRQ6Bj0</string>
</resources>
diff --git a/app/src/release/res/values/google_maps_api.xml b/app/src/release/res/values/google_maps_api.xml
deleted file mode 100644
index 66e392a..0000000
--- a/app/src/release/res/values/google_maps_api.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<resources>
- <!--
- TODO: Before you run your application, you need a Google Maps API key.
-
- To get one, follow this link, follow the directions and press "Create" at the end:
-
-https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=CC:52:01:6E:7D:18:68:C6:89:42:DE:13:CB:F5:83:FC:C6:E3:81:64%3Borg.traccar.manager
-
- You can also add your credentials to an existing key, using this line:
- CC:52:01:6E:7D:18:68:C6:89:42:DE:13:CB:F5:83:FC:C6:E3:81:64;org.traccar.manager
-
- Once you have your key (it starts with "AIza"), replace the "google_maps_key"
- string in this file.
- -->
- <string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
- YOUR_KEY_HERE
- </string>
-</resources>