import unifiedpush
skip skip
This commit is contained in:
parent
812ceb677a
commit
6e484df145
5 changed files with 64 additions and 3 deletions
|
@ -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")
|
||||
}
|
|
@ -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>
|
14
ui/src/main/java/foundation/e/ntefy/ui/MainActivity.kt
Normal file
14
ui/src/main/java/foundation/e/ntefy/ui/MainActivity.kt
Normal file
|
@ -0,0 +1,14 @@
|
|||
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)
|
||||
}
|
||||
}
|
24
ui/src/main/java/foundation/e/ntefy/ui/UnifiedPocReceiver.kt
Normal file
24
ui/src/main/java/foundation/e/ntefy/ui/UnifiedPocReceiver.kt
Normal file
|
@ -0,0 +1,24 @@
|
|||
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")
|
||||
}
|
||||
}
|
7
ui/src/main/res/layout/activity_main.xml
Normal file
7
ui/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?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"/>
|
Loading…
Reference in a new issue