android 平板oem,GitHub - dialogs/oem-android

oem-android

Demo Application to show how integrate Dialog SDK in your client.

image2.png 

image3.png 

42500b415dcd1ae4062608d1ec68dd6d.png

Work with Dialog SDK on the example of a oem-android:

Integrate SDK

❗ DialogSdk should be initialised in one example for app.

initialize Dialog SDK in Application

override fun onCreate() {

super.onCreate()

sdk = DialogSdk(

application = this,

appName = getString(R.string.app_name),

versionCode = BuildConfig.VERSION_CODE,

versionName = BuildConfig.VERSION_NAME,

fcmProjectId = getString(R.string.gcm_defaultSenderId).toLong(),

host = TEST_HOST,

port = TEST_PORT,

deepLinkActivity = BASE_ACTIVITY::class.java,

)

override methods in Activity

override fun onCreate(savedInstanceState: Bundle?) {

sdk.deepLinksResolver.onCreate(this, ::someAction) // someAction - optional

}

override fun onNewIntent(intent: Intent?) {

super.onNewIntent(intent)

setIntent(intent)

sdk.deepLinksResolver.onNewIntent(intent, ::someAction)) // someAction - optional

}

override fun startActivity(intent: Intent?, options: Bundle?) {

sdk.deepLinksResolver.onActivityStarted(

intent,

options,

::selectDialogsTab

) {

super.startActivity(intent, options)

}

}

override fun onDestroy() {

super.onDestroy()

sdk.deepLinksResolver.onDestroy()

}

override fun onBackPressed() {

val currentFragment = // значение в котором хранится текущий корневой фрагмент

if (currentFragment || !sdk.onBackPressed(currentFragment)) super.onBackPressed()

}

dialogOem

ee.dlg.im

Integrate Push

generate google-services.json set with your project

create appropriate config on the server-side.

create class PushService and call sdk: DialogSdk by Singleton/Application/DI/etc.

class PushService : FirebaseMessagingService() {

override fun onMessageReceived(message: RemoteMessage) {

super.onMessageReceived(message)

sdk.pushConsumer.onMessageReceived(message, this)

}

override fun onNewToken(token: String) {

super.onNewToken(token)

sdk.pushConsumer.onNewToken(token, this)

}

override fun onDestroy() {

super.onDestroy()

sdk.pushConsumer.onDestroy(this)

}

}

android:name="PACKAGE_NAME.PushService"

android:exported="false">

Steps to integrate Dialog SDK in your project

Gradle

Add in plugins apply plugin: 'com.google.gms.google-services' in build.gradle(whole project)

Add in implementation implementation "com.google.firebase:firebase-messaging:20.2.4" in build.gradle(whole project)

Add in implementation implementation("im.dlg:sdk:0+") { transitive = true }

Add in dependencies

buildscript {

//

dependencies {

classpath 'com.google.gms:google-services:4.3.3'

}

}

Add in repositories list

repositories {

...

maven {

url "https://external-nexus.dlg.im/nexus/repository/mvn-android/"

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值