Adding methods to native modules is showing undefined when accessed,

i have added below method in android->sdk->src->main->java->AppInfoModule.java,
public void cancelButtonPressed() {
System.out.println(“Cancel Button Pressed”);
JitsiMeetActivityDelegate.onBackPressed();
}

accessed in react-native with following code

const AppInfo = NativeModules.AppInfo;
AppInfo.cancelButtonPressed();

Error is:
AppInfo.cancelButtonPressed is not a function.