Add Link Activity
This commit is contained in:
parent
5f314e35e0
commit
5d6b3b887d
|
@ -39,6 +39,16 @@
|
|||
android:theme="@style/Theme.NextPush.NoActionBar">
|
||||
</activity>
|
||||
|
||||
<activity android:name=".activities.LinkActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="unifiedpush"
|
||||
android:host="link" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".services.StartService"
|
||||
android:enabled="true"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.unifiedpush.distributor.nextpush.activities
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.PendingIntent
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import org.unifiedpush.distributor.nextpush.distributor.EXTRA_PI
|
||||
|
||||
class LinkActivity: Activity() {
|
||||
private val TAG = LinkActivity::class.simpleName
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
intent?.data?.run {
|
||||
Log.d(TAG, "Received request for $callingPackage")
|
||||
val intent = Intent("org.unifiedpush.register.dummy_app")
|
||||
val pendingIntent = PendingIntent.getBroadcast(this@LinkActivity, 0, intent, PendingIntent.FLAG_IMMUTABLE)
|
||||
val result = Intent().apply {
|
||||
putExtra(EXTRA_PI, pendingIntent)
|
||||
}
|
||||
setResult(RESULT_OK, result)
|
||||
} ?: setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ const val ACTION_REGISTER = "org.unifiedpush.android.distributor.REGISTER"
|
|||
const val ACTION_UNREGISTER = "org.unifiedpush.android.distributor.UNREGISTER"
|
||||
|
||||
const val EXTRA_APPLICATION = "application"
|
||||
const val EXTRA_PI = "pi"
|
||||
const val EXTRA_TOKEN = "token"
|
||||
const val EXTRA_ENDPOINT = "endpoint"
|
||||
const val EXTRA_MESSAGE = "message"
|
||||
|
|
Loading…
Reference in New Issue