diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0d3146b..b1dc5c3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,6 +42,7 @@ android:name=".receivers.RegisterBroadcastReceiver" android:enabled="true" > + diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/DistributorUtils.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/DistributorUtils.kt index 8300bbc..55e69e2 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/DistributorUtils.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/DistributorUtils.kt @@ -24,7 +24,7 @@ fun getDb(context: Context): MessagingDatabase { return db!! } -fun sendMessage(context: Context, appToken: String, message: String) { +fun sendMessage(context: Context, appToken: String, message: ByteArray) { val db = getDb(context) val connectorToken = db.getConnectorToken(appToken) val application = getApp(context, connectorToken) @@ -35,7 +35,8 @@ fun sendMessage(context: Context, appToken: String, message: String) { broadcastIntent.`package` = application broadcastIntent.action = ACTION_MESSAGE broadcastIntent.putExtra(EXTRA_TOKEN, connectorToken) - broadcastIntent.putExtra(EXTRA_MESSAGE, message) + broadcastIntent.putExtra(EXTRA_MESSAGE, String(message)) + broadcastIntent.putExtra(EXTRA_BYTES_MESSAGE, message) context.sendBroadcast(broadcastIntent) } diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/UnifiedPushConstants.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/UnifiedPushConstants.kt index 9d94140..c9c5017 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/UnifiedPushConstants.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/distributor/UnifiedPushConstants.kt @@ -15,8 +15,11 @@ const val ACTION_REGISTER = "org.unifiedpush.android.distributor.REGISTER" const val ACTION_UNREGISTER = "org.unifiedpush.android.distributor.UNREGISTER" const val ACTION_MESSAGE_ACK = "org.unifiedpush.android.distributor.MESSAGE_ACK" +const val FEATURE_BYTES_MESSAGE = "org.unifiedpush.android.distributor.feature.BYTES_MESSAGE" + const val EXTRA_APPLICATION = "application" const val EXTRA_TOKEN = "token" const val EXTRA_ENDPOINT = "endpoint" const val EXTRA_MESSAGE = "message" +const val EXTRA_BYTES_MESSAGE = "bytesMessage" const val EXTRA_MESSAGE_ID = "id" diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/SSEListener.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/SSEListener.kt index d7d2a38..1394509 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/SSEListener.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/SSEListener.kt @@ -46,7 +46,7 @@ class SSEListener (val context: Context) : EventSourceListener() { sendMessage( context, message.token, - String(Base64.decode(message.message, Base64.DEFAULT)) + Base64.decode(message.message, Base64.DEFAULT) ) } "deleteApp" -> {