Toggle navigation
Toggle navigation
This project
Loading...
Sign in
손장민
/
FirebaseAuth
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
손장민
2017-10-19 19:47:44 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1283540398a23cb140800043dec41d43d3f73ddd
12835403
1 parent
b83f4e27
Map Fragment Added
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
174 additions
and
15 deletions
app/build.gradle
app/src/debug/res/values/google_maps_api.xml
app/src/main/AndroidManifest.xml
app/src/main/java/com/example/user/firebaseauthdemo/Map.java
app/src/main/res/layout/map.xml
app/src/main/res/values/strings.xml
app/src/release/res/values/google_maps_api.xml
app/build.gradle
View file @
1283540
...
...
@@ -38,6 +38,7 @@ dependencies {
compile
'com.android.support:design:25.3.1'
compile
'com.squareup.picasso:picasso:2.5.2'
compile
'com.google.firebase:firebase-messaging:11.0.2'
compile
'com.google.android.gms:play-services-maps:11.0.2'
testCompile
'junit:junit:4.12'
}
...
...
@@ -46,4 +47,5 @@ dependencies {
apply
plugin:
'com.google.gms.google-services'
\ No newline at end of file
...
...
app/src/debug/res/values/google_maps_api.xml
0 → 100644
View file @
1283540
<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=59:2E:80:8C:A4:7F:B6:08:C9:22:B7:C0:21:56:81:70:CB:42:9B:85%3Bcom.example.user.firebaseauthdemo
You can also add your credentials to an existing key, using these values:
Package name:
59:2E:80:8C:A4:7F:B6:08:C9:22:B7:C0:21:56:81:70:CB:42:9B:85
SHA-1 certificate fingerprint:
59:2E:80:8C:A4:7F:B6:08:C9:22:B7:C0:21:56:81:70:CB:42:9B:85
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string
name=
"google_maps_key"
templateMergeStrategy=
"preserve"
translatable=
"false"
>
AIzaSyCThXzmOil0dxBRQupGmv1YLUi5VXqcr4w
</string>
</resources>
app/src/main/AndroidManifest.xml
View file @
1283540
...
...
@@ -2,9 +2,17 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.example.user.firebaseauthdemo"
>
<user-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<user-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<application
android:allowBackup=
"true"
...
...
@@ -15,18 +23,34 @@
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".MainActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".LoginActivity"
/>
<activity
android:name=
".ProfileActivity"
/>
<activity
android:name=
".LoginActivity"
/>
<activity
android:name=
".ProfileActivity"
/>
<activity
android:name=
".Main2Activity"
android:label=
"@string/title_activity_main2"
android:theme=
"@style/AppTheme.NoActionBar"
/>
<activity
android:name=
".PostActivity"
></activity>
android:theme=
"@style/AppTheme.NoActionBar"
/>
<activity
android:name=
".PostActivity"
/>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name=
"com.google.android.geo.API_KEY"
android:value=
"@string/google_maps_key"
/>
<activity
android:name=
".MapsActivity"
android:label=
"@string/title_activity_maps"
>
</activity>
</application>
</manifest>
\ No newline at end of file
...
...
app/src/main/java/com/example/user/firebaseauthdemo/Map.java
View file @
1283540
...
...
@@ -7,22 +7,101 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.google.android.gms.maps.CameraUpdateFactory
;
import
com.google.android.gms.maps.GoogleMap
;
import
com.google.android.gms.maps.MapView
;
import
com.google.android.gms.maps.OnMapReadyCallback
;
import
com.google.android.gms.maps.model.LatLng
;
import
com.google.android.gms.maps.model.MarkerOptions
;
/**
* Created by HYB on 2017. 10. 11..
*/
public
class
Map
extends
Fragment
{
public
class
Map
extends
Fragment
implements
OnMapReadyCallback
{
private
MapView
mapView
=
null
;
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
Bundle
savedInstanceState
)
{
return
inflater
.
inflate
(
R
.
layout
.
map
,
container
,
false
);
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
layout
=
inflater
.
inflate
(
R
.
layout
.
map
,
container
,
false
);
mapView
=
(
MapView
)
layout
.
findViewById
(
R
.
id
.
mapView
);
mapView
.
getMapAsync
(
this
);
return
layout
;
}
@Override
public
void
onViewCreated
(
View
view
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
public
void
onStart
()
{
super
.
onStart
();
mapView
.
onStart
();
}
getActivity
().
setTitle
(
"Map"
);
@Override
public
void
onStop
()
{
super
.
onStop
();
mapView
.
onStop
();
}
@Override
public
void
onSaveInstanceState
(
Bundle
outState
)
{
super
.
onSaveInstanceState
(
outState
);
mapView
.
onSaveInstanceState
(
outState
);
}
@Override
public
void
onResume
()
{
super
.
onResume
();
mapView
.
onResume
();
}
@Override
public
void
onPause
()
{
super
.
onPause
();
mapView
.
onPause
();
}
@Override
public
void
onLowMemory
()
{
super
.
onLowMemory
();
mapView
.
onLowMemory
();
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
mapView
.
onLowMemory
();
}
@Override
public
void
onActivityCreated
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onActivityCreated
(
savedInstanceState
);
//액티비티가 처음 생성될 때 실행되는 함수
if
(
mapView
!=
null
)
{
mapView
.
onCreate
(
savedInstanceState
);
}
}
@Override
public
void
onMapReady
(
GoogleMap
googleMap
)
{
LatLng
SEOUL
=
new
LatLng
(
37.56
,
126.97
);
MarkerOptions
markerOptions
=
new
MarkerOptions
();
markerOptions
.
position
(
SEOUL
);
markerOptions
.
title
(
"서울"
);
markerOptions
.
snippet
(
"수도"
);
googleMap
.
addMarker
(
markerOptions
);
googleMap
.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
SEOUL
));
googleMap
.
animateCamera
(
CameraUpdateFactory
.
zoomTo
(
13
));
}
}
...
...
app/src/main/res/layout/map.xml
View file @
1283540
...
...
@@ -10,4 +10,9 @@
android:text=
"Terror inform is displayed in here."
android:textAppearance=
"@style/TextAppearance.AppCompat.Headline"
/>
<com.google.android.gms.maps.MapView
android:id=
"@+id/mapView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
...
...
app/src/main/res/values/strings.xml
View file @
1283540
...
...
@@ -6,4 +6,5 @@
<string
name=
"navigation_drawer_close"
>
Close navigation drawer
</string>
<string
name=
"action_settings"
>
Settings
</string>
<string
name=
"title_activity_maps"
>
Map
</string>
</resources>
...
...
app/src/release/res/values/google_maps_api.xml
0 → 100644
View file @
1283540
<resources>
<!--
TODO: Before you release your application, you need a Google Maps API key.
To do this, you can either add your release key credentials to your existing
key, or create a new key.
Note that this file specifies the API key for the release build target.
If you have previously set up a key for the debug target with the debug signing certificate,
you will also need to set up a key for your release certificate.
Follow the directions here:
https://developers.google.com/maps/documentation/android/signup
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string
name=
"google_maps_key"
templateMergeStrategy=
"preserve"
translatable=
"false"
>
YOUR_KEY_HERE
</string>
</resources>
Please
register
or
login
to post a comment