Issue
I have an application using NativeActivity. I want to call out into Java to do something that requires a Context (e.g., accessing TelephonyManager to query the IMEI).
How do I get a valid Context for my activity?
The ANativeActivity structure contains a variety of useful data for my application, such as the JavaVM, and JNI environment, etc. It also contains a jobject pointing at my NativeActivity's class object. What it doesn't contain is a jobject pointing at the NativeActivity's instance. I don't see anything useful in struct android_app
, either.
It must be possible to do this; any ideas how?
Solution
Despite its name the clazz
member of ANativeActivity
struct is actually pointing to android.app.NativeActivity
instance.
Check this post for an example of using a JNI call from the Native Activity to Java code.
Answered By - Idolon
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.