Contexts

interface Contexts : Variable

Context 上下文环境接口。 提供对 Android 应用程序环境的全局信息的访问,允许访问特定于应用程序的资源和类, 以及对应用程序级操作(如启动活动、广播和接收意图等)的调用。

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun getApplication(): Application

获取原始的 Android Application 对象。

Link copied to clipboard
abstract fun getGlobalName(): String

获取作为全局变量时的名称.

Link copied to clipboard
abstract fun getPackageName(): String

获取应用程序包名。

Link copied to clipboard
abstract fun getPublicType(): Type

获取 Variable 注入到脚本时需要显示的类型.

Link copied to clipboard
abstract fun getSystemService(name: String): Any?

通过名称获取系统服务。

Link copied to clipboard
abstract fun isPrefixRequired(): Boolean

是否需要添加前缀, 每种编程语言添加的前缀不一样, 前缀可以通过 Language.getVariablePrefix 获取.

Link copied to clipboard
abstract fun isSuffixRequired(): Boolean

是否需要添加后缀, 每种编程语言添加的后缀不一样, 后缀可以通过 Language.getVariableSuffix 获取.

Link copied to clipboard
abstract fun newBundle(): Bundle

创建一个新的空 Bundle 包装对象。

Link copied to clipboard
abstract fun newIntent(): Intent

创建一个新的空 Intent 包装对象。

Link copied to clipboard
abstract fun sendBroadcast(intentBuilder: Intent.() -> Unit, receiverPermission: String?, bundleBuilder: Bundle.() -> Unit?)

发送一个标准广播。

Link copied to clipboard
abstract fun startActivity(intentBuilder: Intent.() -> Unit, bundleBuilder: Bundle.() -> Unit?)

启动一个新的 Activity。

Link copied to clipboard
abstract fun startService(intentBuilder: Intent.() -> Unit): ComponentName?

启动一个 Service。

Link copied to clipboard
abstract fun stopService(intentBuilder: Intent.() -> Unit): Boolean

停止一个 Service。