|
1 | 1 | package com.example.mapdemo;
|
2 | 2 |
|
3 |
| -import android.app.Activity; |
4 |
| -import android.app.Dialog; |
5 |
| -import android.content.Intent; |
6 |
| -import android.content.IntentSender; |
7 |
| -import android.location.Location; |
8 |
| -import android.os.Bundle; |
9 |
| -import android.support.v4.app.DialogFragment; |
10 |
| -import android.support.v4.app.FragmentActivity; |
11 |
| -import android.support.v7.app.AppCompatActivity; |
12 |
| -import android.util.Log; |
13 |
| -import android.widget.Toast; |
14 |
| - |
15 | 3 | import com.google.android.gms.common.ConnectionResult;
|
16 | 4 | import com.google.android.gms.common.GooglePlayServicesUtil;
|
17 | 5 | import com.google.android.gms.common.api.GoogleApiClient;
|
18 |
| -import com.google.android.gms.location.LocationListener; |
19 | 6 | import com.google.android.gms.location.LocationRequest;
|
20 | 7 | import com.google.android.gms.location.LocationServices;
|
21 | 8 | import com.google.android.gms.maps.CameraUpdate;
|
|
25 | 12 | import com.google.android.gms.maps.SupportMapFragment;
|
26 | 13 | import com.google.android.gms.maps.model.LatLng;
|
27 | 14 |
|
| 15 | +import android.app.Activity; |
| 16 | +import android.app.Dialog; |
| 17 | +import android.content.Intent; |
| 18 | +import android.content.IntentSender; |
| 19 | +import android.location.Location; |
| 20 | +import android.os.Bundle; |
| 21 | +import android.support.v4.app.DialogFragment; |
| 22 | +import android.support.v7.app.AppCompatActivity; |
| 23 | +import android.text.TextUtils; |
| 24 | +import android.util.Log; |
| 25 | +import android.widget.Toast; |
| 26 | + |
28 | 27 | import permissions.dispatcher.NeedsPermission;
|
29 | 28 | import permissions.dispatcher.RuntimePermissions;
|
30 | 29 |
|
@@ -52,6 +51,10 @@ protected void onCreate(Bundle savedInstanceState) {
|
52 | 51 | super.onCreate(savedInstanceState);
|
53 | 52 | setContentView(R.layout.map_demo_activity);
|
54 | 53 |
|
| 54 | + if (TextUtils.isEmpty(getResources().getString(R.string.google_maps_api_key))) { |
| 55 | + throw new IllegalStateException("You forgot to supply a Google Maps API key"); |
| 56 | + } |
| 57 | + |
55 | 58 | mapFragment = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
|
56 | 59 | if (mapFragment != null) {
|
57 | 60 | mapFragment.getMapAsync(new OnMapReadyCallback() {
|
|
0 commit comments