Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method and device for calling Java layer API (Application Program Interface) by native layer in Android system

A Java layer and API calling technology, applied in the direction of multi-programming devices, can solve problems such as low efficiency, program crash, memory leak, etc., to avoid program crash and improve efficiency.

Active Publication Date: 2015-07-15
BEIJING QIHOO TECH CO LTD
View PDF2 Cites 12 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, in the way that the native layer calls the API of the Java layer in the prior art, it is often necessary for the Java layer and the native layer to call each other repeatedly through JNI, which is inefficient and easily causes problems such as memory leaks or program crashes.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for calling Java layer API (Application Program Interface) by native layer in Android system
  • Method and device for calling Java layer API (Application Program Interface) by native layer in Android system
  • Method and device for calling Java layer API (Application Program Interface) by native layer in Android system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0022] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0023] Before describing the embodiments of the present invention, concepts related to the present invention and applicable scenarios of the embodiments of the present invention are briefly introduced.

[0024] As mentioned earlier, Java is platform-independent, so it is not easy to implement some low-level tasks in Java. For example, when it comes to tasks such as local services, link libraries, or hardware drivers, it is usually n...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method and a device for calling a Java layer API (Application Program Interface) by a native layer in an Android system. The method and the device are applied to the native layer of the Android system. The method comprises the steps of binding a native thread with a JNI (Java Native Interface) environment variable corresponding to the Java layer API according to the calling relationship between the native thread and the Java layer API; obtaining the JNI environment variable bound with the native thread according to a calling request of the Java layer API; calling the Java layer API according to the JNI environment variable. Through the scheme, in the process of calling the Java layer API by the native layer, the step of calling a native layer interface by the Java layer to set the JNI environment variable is omitted, the problems of program crash, memory leakage and the like possibly caused by frequent mutual calling between the native layer and the Java layer are avoided, and the efficiency is improved.

Description

technical field [0001] The invention relates to the technical field of computer applications, in particular to a method and a device for calling a Java layer API by a native layer in an Android system. Background technique [0002] The Android operating system is a Linux-based operating system, mainly used in portable devices. The development of upper-layer applications in the Android system is generally completed based on Java. [0003] Java is platform-independent, so it is not easy to implement some low-level tasks in Java. For example, when it comes to local services, link libraries or hardware drivers, etc., it is usually necessary to run C to implement, and C programs run on native (native method) layer. The Java layer and the native layer can call each other through a JNI (Java Native Interface; Java, native interface) mechanism. In the Android system, more functions are provided in the form of Java layer APIs, and the native layer often needs to call these Java la...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/46
Inventor 曾显华乔川北
Owner BEIJING QIHOO TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products