Language: English | Українська
- All client-side logs, including WebView logs, are saved in the
SAMP/cef.log
folder. - There are no additional functions for working with the client part; all necessary functions are specified in the installation instructions below.
Warning
The examples provided below are suitable for most projects, but exceptions are possible.
- Export the
client/cpp/libSAMPMobileCef.a
andclient/cpp/SAMPMobileCef.h
files to your client'svendor/cef
folder (this folder needs to be created manually). - In the
Android.mk
file, include thelibSAMPMobileCef.a
library:include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libSAMPMobileCef LOCAL_SRC_FILES := vendor/cef/libSAMPMobileCef.a LOCAL_STATIC_LIBRARIES := libSAMPMobileCef
- In the
main.cpp
file, include theSAMPMobileCef.h
header file:#include "vendor/cef/SAMPMobileCef.h"
- In the
main.cpp
file, in theInitSAMP
function, set the game cache path:cef::setGamePath(g_pszStorage);
- In the
net/netgame.cpp
file, include theSAMPMobileCef.h
header file in the same way as in themain.cpp
file. - In the
net/netgame.cpp
file, in theCNetGame
constructor, initialize the network part of the library:cef::initNetwork(m_pRakClient, ID_CUSTOM_CEF); // a pointer to RakClient and a custom packet ID for network communication should be passed (e.g., 252 or any other free in PacketEnumeration)
- In the
net/netgame.cpp
file, inCNetGame::UpdateNetwork
, add processing for the previously specified packet:switch (packetIdentifier) { ... case ID_CUSTOM_CEF: // the previously specified ID in initNetwork cef::handlePacket(pkt); break; }
- In the
net/netgame.cpp
file, inCNetGame::Packet_ConnectionSucceeded
, add server connection handling:cef::handleServerConnection(); // at the end of the function
Warning
The examples provided below are suitable for most projects, but exceptions are possible.
- Export the
client/java/sampmobilecef-...-release.aar
file toapp/libs
(thelibs
folder should be created if it does not exist). - In the
app/build.gradle
file, import the previously exported library:dependencies { implementation files("libs/sampmobilecef-...-release.aar") }
- In the
NvEventQueueActivity
file, initialize the following variables:private CefJavaManager mJavaManager = null; private CefClientManager mClientManager = null;
- In the
NvEventQueueActivity
file, in thesystemInit
function, add the initialization of the necessary classes:mJavaManager = new CefJavaManager(mRootFrame, getInstance()); mClientManager = new CefClientManager(getInstance()); mJavaManager.setClientManager(mClientManager); mClientManager.setJavaManager(mJavaManager);
- In the
NvEventQueueueActivity
file, in thesetPauseState
function, add functionality to hide/show the WebView while the pause state is changing:public void setPauseState(boolean z2) { runOnUiThread(() -> { if (mJavaManager.isShow()) { if (z2) mJavaManager.hideBrowserView(); else mJavaManager.showBrowserView(); } }); }
Copyright © 2024 Denis Akazuki.