Getting context from NativeActivity

I have an application using NativeActivity. I want to call in Java to do something that requires context (for example, calling TelephonyManager to request an IMEI).

How to get a valid context for my activity?

The ANativeActivity structure contains a lot of useful data for my application, such as JavaVM and JNI, etc. It also contains a job file pointing to my NativeActivity class object. What it does not contain is a work object that points to an instance of NativeActivity. I do not see anything useful in struct android_app.

It should be possible; any ideas how?

+5
source share
1

, clazz ANativeActivity android.app.NativeActivity.
JNI Native Activity Java.

+4

All Articles