跳转安卓日历app

    fun gotoCalendarApp(cnt: Context){
        try {
            if (cnt is AutoRecordActivity) {
                cnt.closeSmartLifeDialog()
            }
            val intent = Intent(Intent.ACTION_VIEW)
            intent.addCategory(Intent.CATEGORY_DEFAULT)
            intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
            intent.setDataAndType(Uri.parse("content://com.android.calendar/"), "time/epoch")
            cnt.startActivity(intent)
            } catch (e: Exception) {
                e.printStackTrace()
                Toast.makeText(cnt, "暂未适配您的机型,如果想要添加日历提醒,请手动添加", Toast.LENGTH_SHORT).show()
            }
        }

猜你喜欢

转载自blog.csdn.net/qq_15867901/article/details/86175809