Commit 0f60e406 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix manifest, fix service

parent 54f73773
...@@ -14,10 +14,23 @@ ...@@ -14,10 +14,23 @@
android:screenOrientation="userPortrait" android:screenOrientation="userPortrait"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme.Launch"> android:theme="@style/AppTheme.Launch">
<activity
android:name=".base.RoomParkMainActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service <service
android:name=".data.RoomParkMessageService" android:name=".data.RoomParkMessageService"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.MESSAGING_EVENT" />
...@@ -25,9 +38,9 @@ ...@@ -25,9 +38,9 @@
<!-- <!--
Set custom default icon. This is used when no icon is set for incoming notification messages. Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more.--> See README(https://goo.gl/l4GJaQ) for more.-->
<meta-data <meta-data
android:name="com.google.firebase.messaging.default_notification_icon" android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_bell_on" /> android:resource="@drawable/ic_bell_on" />
<!-- <!--
Set color used with incoming notification messages. This is used when no color is set for the incoming Set color used with incoming notification messages. This is used when no color is set for the incoming
...@@ -35,21 +48,10 @@ ...@@ -35,21 +48,10 @@
--> -->
<meta-data <meta-data
android:name="com.google.firebase.messaging.default_notification_color" android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorAccent" /> android:resource="@color/colorAccent" />
</service> </service>
<activity
android:name=".base.RoomParkMainActivity"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -7,25 +7,29 @@ import timber.log.Timber ...@@ -7,25 +7,29 @@ import timber.log.Timber
class RoomParkMessageService : FirebaseMessagingService() { class RoomParkMessageService : FirebaseMessagingService() {
} override fun onNewToken(p0: String) {
super.onNewToken(p0)
Timber.d("NEW TOKEN REGISTERED: ${p0}")
}
fun onMessageReceived(remoteMessage: RemoteMessage) { // ... override fun onMessageReceived(remoteMessage: RemoteMessage) { // ...
// TODO(developer): Handle FCM messages here. // TODO(developer): Handle FCM messages here.
// Not getting messages here? See why this may be: https://goo.gl/39bRNJ // Not getting messages here? See why this may be: https://goo.gl/39bRNJ
Timber.d("From: ${remoteMessage.from}") Timber.d("From: ${remoteMessage.from}")
// Check if message contains a data payload. // Check if message contains a data payload.
if (remoteMessage.data.size > 0) { if (remoteMessage.data.size > 0) {
Timber.d("Message data payload: %s", remoteMessage.data) Timber.d("Message data payload: %s", remoteMessage.data)
if ( /* Check if data needs to be processed by long running job */true) { // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher. if ( /* Check if data needs to be processed by long running job */true) { // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.
// scheduleJob() // scheduleJob()
} else { // Handle message within 10 seconds } else { // Handle message within 10 seconds
// handleNow() // handleNow()
}
} }
} // Check if message contains a notification payload.
// Check if message contains a notification payload. if (remoteMessage.notification != null) {
if (remoteMessage.notification != null) { Timber.d("Message Notification Body: %s", remoteMessage.notification!!.body)
Timber.d("Message Notification Body: %s", remoteMessage.notification!!.body) }
} // Also if you intend on generating your own notifications as a result of a received FCM
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below. // message, here is where that should be initiated. See sendNotification method below.
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment