c - android native ndk jnienv* env -
i new in android native app development. reseons need run .so file @ sdcard elf file(executable file). need define jnienv* env variable in elf file , pass .so file dlopen command, or define jnienv* env in .so file, want send sms in native android application. native method below:
void java_com_example_calljavaservice_mainactivity_getjnistring() { //i should define env variable here jclass smsmanagerclz = (*env)->findclass(env, "android/telephony/smsmanager"); jmethodid getdefaultmethodid = (*env)->getstaticmethodid(env, smsmanagerclz,"getdefault", "()landroid/telephony/smsmanager;"); jobject smsmanagerobj = (*env)->callstaticobjectmethod(env, smsmanagerclz, getdefaultmethodid); jmethodid sendsmsmethodid = (*env)->getmethodid(env, smsmanagerclz, "sendtextmessage","(ljava/lang/string;ljava/lang/string;ljava/lang/string;""landroid/app/pendingintent;landroid/app/pendingintent;)v"); jstring number = (*env)->newstringutf(env, "5554"); jstring text = (*env)->newstringutf(env, "sms content"); jstring nullstring = (*env)->newstringutf(env, ""); (*env)->callvoidmethod(env, smsmanagerobj, sendsmsmethodid, number, nullstring, text, null, null); }
i don't have jnienv* env in method parameters, , want define env variable in method, don't know how define that.i don't want send env variable method. suppose want call .so file elf file in sdcard, in advance.
Comments
Post a Comment