PLUG Android Guide
Quick Start
Download latest version
Run sample project
The method for running a sample project for plugin on Android Studio is described below.
Open the project in sample/navercafesdk-sample-android-studio folder on Android Studio.
Build the project.
Check if the plugin is running normally in the application.
1. Application manifest settings
Add access authority and activity to the AndroidManifest.xml file as described below.
1.1 Access authority for PLUG SDK
Add the access authority that is needed for PLUG SDK.
1.2 Access authority for video recording
Add the access authority that is needed for using video recording functions.
2. Initialization
Initialize PLUG SDK according to the language that is being supported, as explained below.
2.1 PLUG SDK initialization (only supports Korean - Naver cafe)
When initializing PLUG SDK that only supports Korean, apply initialization settings as indicated below and call for init() method.
ClientId: Client ID received when registering application on the login developer center using Naver ID
ClientSecret: Client secret received when registering application on the login developer center using Naver ID
cafeId: Cafe ID init() method received by opening a Naver cafe is the method used for initialization on PLUG SDK.
2.2 PLUG SDK initialization (only supports foreign languages - Moot)
When initializing PlUG SDK that only supports foreign languages, apply initialization settings as indicated below and call for initGlobal() method.
consumerKey: Consumer key received by opening the community
consumerSecretKey: Consumer secret key received by opening the community
cummunityNo: Community No. received by opening the community
loungeNo: Lounge No. received by opening the lounge
initGlobal() method is used for carrying out initialization on PLUG SDK that supports foreign languages.
2.3 Initialization of a plugin that supports the global community and a domestic Naver cafe
Use initGlobal() method and init() method for plugin initialization when it supports both the global community and a domestic Naver cafe.
The following is an example of plugin initialization.
3. Start PLUG SDK
Run PLUG SDK after initialization is complete.
3.1 startHome() method
startHome() method is used for starting PLUG SDK while home tab is selected.
Start / Close PLUG
Start or finish Naver PLUG while a certain tab is selected.
startHome() method
Start the PLUG while home tab is selected.
The following is an example of the startHome() method.
stop() method
Immediately close the PLUG screen and exit the PLUG.
The following is an example of the stop() method.
isShowGlink() method
Check if the PLUG screen is open.
The following is an example for the isShowGlink() method.
Basic channel settings
Settings for the basic channel, which is the community for each language on the PLUG, is applied with the language that is set on the device. If you wish to apply settings to the basic channel with a certain language, use the setChannelCode() method.
The following is an example for setting a certain language on the basic channel.
Horizontal mode, vertical mode
The PLUG supports both horizontal and vertical modes.
In the Android environment, horizontal and vertical modes are automatically applied without having to apply the setting separately.
Adjust transparency
If you adjust transparency using the adjustment slider on the upper left side of the PLUG screen, you can use the game and the cafe at the same time.
You can set the setTransparentable() method to enable the transparency adjustment slider in the Android environment.
If you set "true" for the isTransparentable parameter value, you can use the transparency adjustment slider (default value: true).
The following is an example of using the transparency adjustment slider.
Widget
A widget is an element that is automatically displayed on the screen when the fold button is pressed on the PLUG. You can use the PLUG anywhere in the game by using a widget.
Widget display
You can apply the showWidgetWhenUnloadSDK() method setting in order to display the widget when the fold button is pressed on the PLUG.
If you set true on useWidget parameter value, widget is displayed when plug window is folded (default value: true).
The following is an example of displaying the widget.
Run widget
Use the startWidget() method for running the widget.
startWidget() method is supported on PLUG 1.7.0 or above.
The following is an example of running the widget.
Close widget
Use the stopWidget() method to close the widget.
The following is an example of force closing the widget.
Default position settings for the widget
When the widget is first run, it is displayed on the center-left part of the screen. If you wish to set the default position settings when the widget is first run, use the setWidgetStartPosition() method.
However, when the widget is run again after the user has moved the widget, the widget will be displayed in the position where the user last moved it.
The default position setting for widget is supported on PLUG 2.3.0 or above.
The following is an example for setting the widget's default position to 20% from top, on the right side of the screen.
Screen capture
You can capture the game screen by pressing the screen capture button on the widget.
Screen capture button
The screen capture function is run by registering the widget screen capture button click listener (OnWidgetScreenshotClickListener) with the setOnWidgetScreenshotClickListener() method.
The following is an example of running the widget screen capture button click listener.
Screen capture settings
You can use the setUseWidgetScreenShot() method to enable screen capture functionality.
If you set the parameter value as true, the screen capture button is displayed on the widget (default value: true).
The following is an example of using the screen capture function.
Video recording
If you press the video recording button, you can record the game screen while playing the game.
The video recording function is supported on Android 5.0 or above.
Access authority settings
In order to use the video recording function, you should add access authority on the Androidmanifest.xml file as indicated below.
Use the video recording function on the widget
If you press the video recording button on the widget, you can record the game screen while playing the game.
Video recording settings
You can use the setUseVideoRecord() method to enable the video recording function.
If you set the use parameter value as true, the video recording button will be displayed on the widget (default value: true).
The video recording button is not displayed on the widget for devices using Android 5.0 or below, even if you set use parameter value as true.
The following is an example of using the video recording function.
Recording ended listener
Tasks that should be processed after completing video recording are run by registering that the recording is complete for the listener (OnRecordFinishListener) with the setOnRecordFinishListener() method.
The following is an example of using the recording ended listener.
Use the video recording function on the game
You can run the video recording button from the game developer to record the game screen.
Start / Stop video recording
Use the startRecord() method to start video recording.
Use the stopRecord() method to stop video recording.
Video recording callback listener
Callback listener that processes event that is occurred from video recording using the button on game developer should be registered for use.
The following is an example of using the video recording listener.
App scheme processing
When you press the banner image that is displayed on the home screen of the game PLUG, you can go to the App scheme to run game functions.
You can register the banner image for moving to the App scheme from the cafe management menu.
When the touch event has occurred on the banner image that is moving to the App scheme, functions for processing the App scheme are carried out by registering the App scheme listener (OnClickAppSchemeBannerListener) with the setOnClickAppSchemeBannerListener() method.
The following is an example of using the setOnClickAppSchemeBannerListener() method for processing the App scheme.
Callback listener
Register the callback listener to process events that have occurred in the PLUG.
PLUG startup listener
OnSdkStartedListener is callback listener that processes events that have occurred when the PLUG starts.
Tasks that should be processed are carried out by registering OnSdkStartedListener with the setOnSdkStartedListener() method.
The following is an example of using the PLUG startup listener.
PLUG closing listener
OnSdkStoppedListener is a callback listener that processes events that have occurred when the PLUG is closing.
Tasks that should be processed are carried out by registering OnSdkStoppedListener with the setOnSdkStoppedListener() method.
the following is an example of using the PLUG closing listener.
App scheme listener
onClickAppSchemeBannerListener is a callback listener that processes events that have occurred when pressing the banner image that goes to the App scheme.
Refer to “App scheme processing” for details about the App scheme.
처리할 작업은 setOnClickAppSchemeBannerListener() 메서드에 OnClickAppSchemeBannerListener를 등록해 구현한다.
The following is an example of using the App scheme listener.
Cafe registration listener
OnJoinedListener is a callback listener that processes events that have occurred when game users join the cafe on the PLUG.
Tasks that should be processed are carried out by registering onJoinedListener with the setOnJoinedListener() method.
The following is an example of using the cafe registration listener.
Post registration listener
OnPostedArticleListener is a callback listener that processes events that have occurred when users register posts on the PLUG.
Tasks that should be processed are carried out by registering OnPostedArticleListener with the setOnPostedArticleListener() method.
The following is an example of using the post registration listener.
Comment registration listener
OnPostedCommentListener is a callback listener that processes events that have occurred when users post comments on the PLUG.
Tasks that should be processed are carried out by registering OnPostedCommentListener with the setOnPostedCommentListener() method.
The following is an example of using the comment registration listener.
Voting ended listener
OnVotedListener is a callback method that processes events that have occurred when users complete voting on comments on the PLUG.
Tasks that should be processed are carried out by registering OnVotedListener with the setOnVotedListener() method.
The following is an example of using the voting ended listener.
Screen capture button click listener
OnWidgetScreenshotClickListener is a callback listener that processes events that have occurred when users pressed the screen capture button on the widget. Refer to "widget” for details about the screen capture button.
Tasks that should be processed are carried out by registering OnWidgetScreenshotClickListener with the setOnWidgetScreenshotClickListener() method.
The following is an example of using the screen capture button click listener. By using the screen capture function on the callback listener, you can capture the screen when you press the screen capture button.
Recording ended listener
onRecordFinishListener is a callback listener that processes events that have occurred when video recording is ended on the PLUG.
Tasks that should be processed are carried out by registering OnRecordFinishListener with the setOnRecordFinishListener() method.
The following is an example of using the recording ended listener.
Game ID linkage
By linking the user’s game ID and cafe ID, they can be managed. You can check for the list of linked game ID and cafe IDs from cafe management menu.
In order to link a game ID and cafe ID, the syncGameUserId() method should be used.
The following is an example of linking the game ID and cafe ID.
Change theme color
You can change the theme color of the PLUG.
In order to change the theme color, the setThemeColor() method is used.
themeColorCSSString: The default color that is used on the theme (default value: #00c73c)
backgroundCSSString: the background color for the tab menu (default value: #44484e). It is recommended that you use the default value.
Caution Do not apply alpha values for the CSS color value.
Correct example: #ff9800
Incorrect example: #e2ff9800
The following is an example of changing the theme color.
Change resource image
The resource image that is included in Naver cafe PLUG library can be changed as indicated below.
Unzip the Naver cafe PLUG library file (.aar file).
Change the image in the /res/drawable-xhdpi folder to the desired image.
Compress the unzipped folder to a library file (.aar file).
Apply the new Naver cafe PLUG library to build the project
Caution When changing the image, the new image's size should be identical with the previous image.
Last updated