java代码:
MainActivity Activity [email protected] onCreateBundle savedInstanceStateonCreatesavedInstanceStatesetContentViewRlayoutactivity_mainsendTextMessagesendMessageObject handlerString whoNumberString messagesendTextMessageObject handlerString whoNumberString message
NDK JNI代码:
Java_com_mrper_messager_MainActivity_sendMessage (*envobjhandlerwhoNumbermessage){ cls_activity = env->FindClass() = env->GetMethodID(cls_activity)cls_intent = env->FindClass()mid_struct = env->GetMethodID(cls_intent)fid_msg = env->GetStaticFieldID(cls_intent)field_msg = env->GetStaticObjectField(cls_intentfid_msg)cls_uri = env->FindClass()mid_parse = env->GetStaticMethodID(cls_uri)mobj_parse = env->CallStaticObjectMethod(cls_urimid_parsewhoNumber)obj_intent = env->NewObject(cls_intentmid_structfield_msgmobj_parse)mid_putExtra = env->GetMethodID(cls_intent)msg_tag = env->NewStringUTF()env->CallObjectMethod(obj_intentmid_putExtramsg_tagmessage)env->CallVoidMethod(handlerobj_intent)} Java_com_mrper_messager_MainActivity_sendTextMessage (*envhandlerobjectwhoNumbermessage){ cls_sms = env->FindClass()mid_instance = env->GetStaticMethodID(cls_sms)obj_sms = env->CallStaticObjectMethod(cls_smsmid_instance)mid_sms = env->GetMethodID(cls_sms)cls_pendingIntent = env->FindClass()mid_pendingIntent = env->GetStaticMethodID(cls_pendingIntent)cls_intent = env->FindClass()mid_intentStruct = env->GetMethodID(cls_intent)action_send = env->NewStringUTF()obj_sIntent = env->NewObject(cls_intentmid_intentStructaction_send)action_delivery = env->NewStringUTF()obj_rIntent = env->NewObject(cls_intentmid_intentStructaction_delivery)obj_sPendingIntent = env->CallStaticObjectMethod(cls_pendingIntentmid_pendingIntenthandlerobj_sIntent)obj_rPendingIntent = env->CallStaticObjectMethod(cls_pendingIntentmid_pendingIntenthandlerobj_rIntent)env->CallVoidMethod(obj_smsmid_smswhoNumbermessageobj_sPendingIntentobj_rPendingIntent)}
时间: 2024-12-09 08:08:46