Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e484df1 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

import unifiedpush

skip

skip
parent 812ceb67
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -35,9 +35,11 @@ android {
dependencies {

    implementation 'androidx.core:core-ktx:1.13.1'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.12.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'

    implementation("com.github.UnifiedPush:android-connector:2.2.0")
}
 No newline at end of file
+16 −2
Original line number Diff line number Diff line
@@ -7,6 +7,20 @@
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Ntfy" />

        android:theme="@style/Theme.Ntfy">
        <activity android:exported="true" android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <receiver android:exported="true" android:enabled="true" android:name=".UnifiedPocReceiver">
            <intent-filter>
                <action android:name="org.unifiedpush.android.connector.MESSAGE"/>
                <action android:name="org.unifiedpush.android.connector.UNREGISTERED"/>
                <action android:name="org.unifiedpush.android.connector.NEW_ENDPOINT"/>
                <action android:name="org.unifiedpush.android.connector.REGISTRATION_FAILED"/>
            </intent-filter>
        </receiver>
    </application>
</manifest>
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
package foundation.e.ntefy.ui

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import org.unifiedpush.android.connector.UnifiedPush

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        UnifiedPush.registerAppWithDialog(this)
    }
}
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
package foundation.e.ntefy.ui

import android.content.Context
import android.util.Log
import org.unifiedpush.android.connector.MessagingReceiver

class UnifiedPocReceiver: MessagingReceiver() {

    companion object {
        const val TAG = "UnifiedPocReceiver"
    }

    override fun onMessage(context: Context, message: ByteArray, instance: String) {
        super.onMessage(context, message, instance)
        val utf8Message = String(message)

        Log.i(TAG, "onMessage $utf8Message")
    }

    override fun onNewEndpoint(context: Context, endpoint: String, instance: String) {
        super.onNewEndpoint(context, endpoint, instance)
        Log.i(TAG, "onNewEndpoint $endpoint")
    }
}
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity"/>
 No newline at end of file