Skip to content

[EN] Android Studio Sample

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

Run Sample Project in Android Studio

The following steps show you how to run a sample project for the NAVER Cafe SDK in Android Studio.

  1. Go to the sample/navercafesdk-sample-android-studio folder and open a project.
  2. Build the project.
  3. Check if the NAVER Cafe SDK is running on your app.

Configure Project

Note that the sample project includes the initialization and app manifest files required to run the NAVER Cafe SDK.

Initialize the NAVER Cafe SDK

Use the onCreate() method of the main activity to define initialize options for the NAVER Cafe SDK. The init() method is used 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);
    ...
}

Use the startHome() method to start the NAVER Cafe SDK with the Home tab selected.

Glink.startHome(MainActivity.this);

Configure App Manifest

The app manifest setting is included in the AndroidManifest.xml file, which belongs to a library (.arr file). Therefore, you don't have to edit the AndroidManifest.xml file in order to run a sample project.

Other NAVER CAFE SDK Documents.

Unity

Unreal

Cocos-2dx

iOS

Clone this wiki locally