Android的:如何播放从本地code意图是什么?意图、Android、code

2023-09-05 02:43:27 作者:未来是拼出来的

是否可以播放从本地code的意图是什么?如果是这样,有文件和/或样品code就相关的API?

Is it possible to broadcast an Intent from native code? If so, is there documentation and/or sample code pertaining to the relevant APIs?

推荐答案

您将需要通过调用Java API函数来调用它 - 没有JNI接口的意图

You will need to call it by calling the Java API function - there is no JNI interface for intents.

首先查找类意图,然后查找方法构造意图和广播他们,给他们打电话。

First look up the class for Intent, then look up the methods for constructing intents and broadcasting them, and call them.

编辑:这是一个的不完整的的例子。 的JNIEnv 传递到所有的JNI功能。

Here is an incomplete example. jniEnv is passed into all your JNI functions.

jclass activityClass = jniEnv->FindClass("android/app/Activity");
jmethodID startAcitivtyMethod = jniEnv->GetMethodID(activityClass , "startActivity", "(Landroid/content/Intent;)V");
jniEnv->CallVoidMethod(yourActivityObject, startAcitivityMethod, yourIntentObject);