Skip to content

Initializing SDK

CMAdSDK edited this page May 31, 2016 · 15 revisions

Init SDK

Before you integrate advertisement,Please initialize PEGASI SDK.At the same time ,we strongly recommended that initialization in the onCreate method of Application. For example:

/**
 * it is strongly recommended that custom Application
 * and initialized SDK in application#onCreate()
 */
public class MyApplication extends Application {

	@Override
	public void onCreate() {
        super.onCreate();
        //init sdk
        //The first parameter:Context
        //The second parameter: Mid(the identifier of the app,the first four numbers of posid)
        //The third parameter:product channel id(can be null)
        CMAdManager.applicationInit(Context, Your Mid, "");

        //if you want to print debug log ,set it
        //CMAdManager.enableLog();
    }
}

Updating your AndroidManifest.xml

update your application name,for example:

  <application
        android:allowBackup="true"
        android:name="com.cmcm.ads.MyApplication" //update your application name
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity android:name=".MainActivity">
        ...
        ...
   </application>

Clone this wiki locally