我正在开发我的自定义呼叫应用程序,例如 Skype,当我收到 fcm 消息时,我需要向用户显示“来电”屏幕。为此,我使用全屏意图通知。我现在的代码是这样的:
val intent = Intent(Intent.ACTION_MAIN, null)
val fakeIntent = Intent()
intent.flags = Intent.FLAG_ACTIVITY_NO_USER_ACTION or Intent.FLAG_ACTIVITY_NEW_TASK
intent.setClass(ctx, IncomingCallActivity::class.java!!)
val pendingIntent = PendingIntent.getActivity(ctx, 1, intent, 0)
val pendingIntent2 = PendingIntent.getActivity(ctx, 1, fakeIntent, PendingIntent.FLAG_ONE_SHOT)
val builder = Notification.Builder(ctx)
builder.setOngoing(true)
builder.setPriority(Notification.PRIORITY_HIGH)
// Set notification content intent to take user to fullscreen UI if user taps on the
// notification body.
builder.setContentIntent(pendingIntent)
// Set full screen intent to trigger display of the fullscreen UI when the notification
// manager deems it appropriate. …Run Code Online (Sandbox Code Playgroud) 我正在尝试iOS callkit在Android 上实现行为。我收到了来自Firebase的推送通知,并且想向用户显示“来电”屏幕。为此,我使用ConnectionService了android.telecompackage和其他类。
这是我的呼叫管理器类:
class CallManager(context: Context) {
val telecomManager: TelecomManager
var phoneAccountHandle:PhoneAccountHandle
var context:Context
val number = "3924823202"
init {
telecomManager = context.getSystemService(Context.TELECOM_SERVICE) as TelecomManager
this.context = context
val componentName = ComponentName(this.context, CallConnectionService::class.java)
phoneAccountHandle = PhoneAccountHandle(componentName, "Admin")
val phoneAccount = PhoneAccount.builder(phoneAccountHandle, "Admin").setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED).build()
telecomManager.registerPhoneAccount(phoneAccount)
val intent = Intent()
intent.component = ComponentName("com.android.server.telecom", "com.android.server.telecom.settings.EnableAccountPreferenceActivity")
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
}
@TargetApi(Build.VERSION_CODES.M)
fun startOutgoingCall() {
val extras = Bundle()
extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, true)
val manager = context.getSystemService(TELECOM_SERVICE) as TelecomManager
val phoneAccountHandle …Run Code Online (Sandbox Code Playgroud) 我在我的Android应用程序中使用Room Persistence Library,但在创建之后我无法在设备上找到包含表格的.sql文件.
当我创建数据库时,SQLiteOpenHelper我可以在设备上的文件夹数据中看到我的所有表格,但是当我通过Room创建数据库时,任何地方都没有文件.
我在哪里可以看到所有表格的内容?
创建数据库代码:
@Provides
@Singleton
PokuponDataBase providePokuponDataBase() {
return Room.inMemoryDatabaseBuilder(SuperDealApp.getInstance().getApplicationContext(), PokuponDataBase.class, "PokuponRoomDatabase").build();
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试为Android Studio 3.0和gradle插件3.0设置不同的构建变体,但Android Studio不会为每个我的风格创建构建变体.Gradle构建是成功的但我不知道如何制作productionapiRealese和germanyapiRelease构建变体.我该怎么做?
我的口味:
flavorDimensions "pr", "ger"
productFlavors {
productionapi {
provider "pk"
dimension "pr"
}
germanyapi {
provider "sd"
dimension "ger"
}
}
Run Code Online (Sandbox Code Playgroud)
我的构建变体:
android gradle android-studio android-productflavors android-studio-3.0