Skip to content

Commit c725923

Browse files
author
Mehrdad Safari
committed
Bug Fix And Change Amq Port
1 parent 5701147 commit c725923

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

ArTalkNotificationCore/src/main/java/com/araditc/anc/Arad.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.araditc.anc
22

33
import android.annotation.SuppressLint
44
import android.content.Context
5+
import android.os.Handler
56
import com.araditc.anc.data.local.IMessage
67
import com.google.android.gms.tasks.Tasks
78
import com.google.firebase.FirebaseApp
@@ -92,7 +93,7 @@ object Arad {
9293
val editor = sharedPreferences.edit()
9394
editor.putString("clientUserName", clientUserName)
9495
editor.putString("clientPassword", clientPassword)
95-
editor.putString("connectionURL", "tcp://$connectionURL:1883")
96+
editor.putString("connectionURL", "tcp://$connectionURL")
9697
editor.apply()
9798
}
9899

@@ -125,6 +126,7 @@ object Arad {
125126

126127
override fun messageArrived(topic: String, message: MqttMessage) {
127128
setMessage(message.payload.toString(Charsets.UTF_8))
129+
disconnectBroker()
128130
}
129131

130132
override fun deliveryComplete(token: IMqttDeliveryToken) {
@@ -156,7 +158,7 @@ object Arad {
156158
}
157159

158160
private fun subscribeToTopicBroker(topic: String) {
159-
broker.subscribe(topic, 0, null, object : IMqttActionListener {
161+
broker.subscribe(topic, 1, null, object : IMqttActionListener {
160162
override fun onSuccess(asyncActionToken: IMqttToken?) {
161163
}
162164

ArTalkNotificationCore/src/main/java/com/araditc/anc/service/fcm/FcmMessaging.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.araditc.anc.service.fcm
22

3+
import android.util.Log
34
import com.google.firebase.messaging.FirebaseMessagingService
45
import com.google.firebase.messaging.RemoteMessage
56
import com.araditc.anc.Arad
67

78
class FcmMessaging : FirebaseMessagingService() {
89

910
override fun onMessageReceived(remoteMessage: RemoteMessage) {
11+
Log.i("APN" , "Fcm WakeUp")
1012
Arad.setWakeUp(true)
1113
}
1214

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ implementation 'com.github.araditc:Arad.Push.Android.SDK:TAG'
5858
>```
5959
6060
>```kotlin
61-
> var devicename = DeviceUtils.getDeviceName()
61+
> var deviceName = DeviceUtils.getDeviceName()
6262
> var packageName = DeviceUtils.getPackageName(this)
6363
> var deviceVersion = DeviceUtils.getVersion(this)
6464
> //================================ FCM Implementation ======================================

app/src/main/java/com/araditc/ane/ui/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MainActivity : ComponentActivity() {
1414
super.onCreate(savedInstanceState)
1515

1616
//================================= Device Util ============================================
17-
var devicename = DeviceUtils.getDeviceName()
17+
var deviceName = DeviceUtils.getDeviceName()
1818
var packageName = DeviceUtils.getPackageName(this)
1919
var deviceVersion = DeviceUtils.getVersion(this)
2020
//================================ FCM Implementation ======================================
@@ -37,7 +37,7 @@ class MainActivity : ComponentActivity() {
3737
Arad.getMessage(this@MainActivity);
3838
Arad.setIMessage(object : IMessage {
3939
override fun MessageReceive(payload: String) {
40-
Log.i("APN", "Message Receive If Message Exist For This User In Server")
40+
Log.i("APN", "Message Receive If Message Exist For This User In Server $payload")
4141
}
4242
})
4343
Arad.setIWakeUp(object : IWakeUp {

0 commit comments

Comments
 (0)