Skip to content

[EN] Initialization

Changhoon Yang edited this page Oct 24, 2016 · 2 revisions

Configure Initialization

In this page, we will describe settings for app manifest and initialization, which is required to run the NAVER Cafe SDK.

1. Edit the AndroidManifest.xml File

Add the permissions and activities to the AndroidManifest.xml file, which is one of the Eclipse project files. If you're using Android Studio to open a project, you don't have to add additional settings for initialization because it is already included in the library package (.aar file).

Permission for the NAVER Cafe SDK

Add a permission in order to access the NAVER Cafe SDK.

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Permission for the Video Recording

Add a permission in order to use the video recording functionality.

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>

Add Activities

Add activities used in NAVER Login and the NVER Cafe SDK.

    <activity
        android:name="com.nhn.android.naverlogin.ui.OAuthLoginActivity"
        android:screenOrientation="sensorLandscape"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
    <activity
        android:name="com.nhn.android.naverlogin.ui.OAuthLoginInAppBrowserActivity"
        android:screenOrientation="sensorLandscape"
        android:label="OAuth2.0 In-app"/>
    <activity
       android:name="com.naver.glink.android.sdk.ui.VideoPlayActivity"
       android:screenOrientation="sensorLandscape"
       android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>

2. Initialize the NAVER Cafe SDK

Use the init() method to initialize the NAVER Cafe SDK.

public static void init(Activity activity, String clientId, String clientSecret, int cafeId);

The following code shows an example of how to initialize the NAVER Cafe SDK.

public class MainActivity extends Activity {

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    /**
     * Initialize the NAVER Cafe SDK using information obtained when you registered your application in NAVER Login Developers.
     * You must perform the initialization before you call methods of the Glink class.
     * NAVER Login Developers: https://nid.naver.com/devcenter/main.nhn
     */

    final int cafeId = 28290504;
    final String clientId = "197CymaStozo7X5r2qR5";
    final String clientSecret = "evCgKH1kJL";
    Glink.init(this, clientId, clientSecret, cafeId);
}

Other NAVER CAFE SDK Documents.

Unity

Unreal

Cocos-2dx

iOS

Clone this wiki locally