Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Extracts information about the GPU on Android devices

Notifications You must be signed in to change notification settings

candide-com/react-native-gpu-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-gpu-info

Getting started

$ npm install react-native-gpu-info --save

Mostly automatic installation

$ react-native link react-native-gpu-info

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNGpuInfoPackage; to the imports at the top of the file
  • Add new RNGpuInfoPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-gpu-info'
    project(':react-native-gpu-info').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-gpu-info/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-gpu-info')
    

Usage

Within your host activity add the following code;

public class MainActivity extends ReactActivity { 
	private GlSurfaceInspector surfaceInspector = new GlSurfaceInspector();

	@Override
	public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			surfaceInspector.init(this);
	}

	@Override
	protected void onPause() {
			super.onPause();
			surfaceInspector.onPause();
	}

	@Override
	protected void onResume() {
			super.onResume();
			surfaceInspector.onResume();
	}
}

Then in your Javascript code import the library;

import RNGpuInfo from 'react-native-gpu-info';

And retrieve the name of the GPU chip via;

const glRenderer = RNGpuInfo.getGlRenderer()

About

Extracts information about the GPU on Android devices

Resources

Stars

Watchers

Forks

Packages

No packages published