soonmyeong2

make push alarm file

wello_firebase_SDKKey.json
\ No newline at end of file
from firebase_admin import messaging
from firebase_admin import credentials
import firebase_admin
cred = credentials.Certificate('wello_firebase_SDKKey.json')
default_app = firebase_admin.initialize_app(cred)
def send_to_topic():
# [START send_to_topic]
# The topic name can be optionally prefixed with "/topics/".
topic = 'c1_1'
# See documentation on defining a message payload.
message = messaging.Message(
title = 'wef',
data={
'score': '850',
'time': '2:45',
},
topic=topic,
)
# Send a message to the devices subscribed to the provided topic.
response = messaging.send(message)
# Response is a message ID string.
print('Successfully sent message:', response)
send_to_topic()
......@@ -81,17 +81,16 @@ class SearchActivity : AppCompatActivity() {
key.add(temp.toString())
}
}
no_search.setVisibility(View.GONE)
policy_scroll_view.setVisibility(View.VISIBLE)
for (i in key) {
val key_query = database.orderByChild("Policy").equalTo("$i")
key_query.addListenerForSingleValueEvent(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot) {
//Toast.makeText(getBaseContext(), dataSnapshot.getValue().toString(), Toast.LENGTH_SHORT).show()
no_search.setVisibility(View.GONE)
policy_scroll_view.setVisibility(View.VISIBLE)
for (memoSnapshot in dataSnapshot.children){
val memo = memoSnapshot.getValue(MemoItem::class.java)
......@@ -113,7 +112,6 @@ class SearchActivity : AppCompatActivity() {
if (key.size == 0) {
policy_scroll_view.setVisibility(View.GONE)
no_search.setVisibility(View.VISIBLE)
}
//////////
......