Showing
5 changed files
with
54 additions
and
1 deletions
.gitignore
0 → 100644
1 | +wello_firebase_SDKKey.json |
db_connector.php
0 → 100644
1 | +<?php | ||
2 | + //쿼리 | ||
3 | + $query = "select * from wello.policy"; | ||
4 | +\ mysql_select_db("admin", $conn); | ||
5 | + | ||
6 | + mysql_query("set 정책명 utf8"); //간단히 이거 한줄이면 되네 | ||
7 | + | ||
8 | + $result = mysql_query($query, $conn); | ||
9 | + | ||
10 | + while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { | ||
11 | + $res['정책명'] = urlencode($row["정책명"]); | ||
12 | + $res['링크'] = urlencode($row["링크"]); | ||
13 | + $arr["result"][] = $res; | ||
14 | + } | ||
15 | + | ||
16 | + $json = json_encode ($arr); | ||
17 | + $json = urldecode ($json); | ||
18 | + print $json; | ||
19 | + mysql_close($conn); | ||
20 | +?> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
push_message.py
0 → 100644
1 | +import firebase_admin | ||
2 | +from firebase_admin import credentials | ||
3 | +from firebase_admin import messaging | ||
4 | +from firebase_admin import datetime | ||
5 | + | ||
6 | +cred = credentials.Certificate("./wello_firebase_SDKKey.json") | ||
7 | +wello = firebase_admin.initialize_app(cred) | ||
8 | + | ||
9 | +topic = 'news' | ||
10 | + | ||
11 | +# See documentation on defining a message payload. | ||
12 | +message = messaging.Message( | ||
13 | + android=messaging.AndroidConfig( | ||
14 | + ttl=datetime.timedelta(seconds=3600), | ||
15 | + priority='normal', | ||
16 | + notification=messaging.AndroidNotification( | ||
17 | + title='기성이와', | ||
18 | + body='률이안나', | ||
19 | + icon='', | ||
20 | + color='#f45342', | ||
21 | + sound='default' | ||
22 | + ), | ||
23 | + ), | ||
24 | + data={ | ||
25 | + 'score': '850', | ||
26 | + 'time': '2:45', | ||
27 | + }, | ||
28 | + topic=topic | ||
29 | +) | ||
30 | + | ||
31 | +response = messaging.send(message) | ||
32 | +print('Successfully sent message:', response) |
sample_data.json
0 → 100644
This diff could not be displayed because it is too large.
... | @@ -17,7 +17,7 @@ class PushingActivity : AppCompatActivity() { | ... | @@ -17,7 +17,7 @@ class PushingActivity : AppCompatActivity() { |
17 | subscribeButton.setOnClickListener { | 17 | subscribeButton.setOnClickListener { |
18 | Log.d(TAG, "Subscribing to weather topic") | 18 | Log.d(TAG, "Subscribing to weather topic") |
19 | // [START subscribe_topics] | 19 | // [START subscribe_topics] |
20 | - FirebaseMessaging.getInstance().subscribeToTopic("news") | 20 | + FirebaseMessaging.getInstance().subscribeToTopic("kisung") |
21 | .addOnCompleteListener { task -> | 21 | .addOnCompleteListener { task -> |
22 | var msg = getString(R.string.msg_subscribed) | 22 | var msg = getString(R.string.msg_subscribed) |
23 | if (!task.isSuccessful) { | 23 | if (!task.isSuccessful) { | ... | ... |
-
Please register or login to post a comment