Initialize - san-sdk/sample GitHub Wiki
Initialize
After you have integrated the SAN SDK and created an ad placement, you must call SanAdSdk.init()
before you send any ad requests. Initialization is required for a number of new functionalities:
It is recommended to initialize in Application onCreate()
on main process, we do not support multiple processes.
public class MyApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
if (isMainProcess)
SanAdSdk.init(this);
}
}
EU Consent and GDPR
What is GDPR, please refer to General Data Protection Regulation (GDPR)
If the user agrees to the GDPR agreement
public class MyApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
if (isMainProcess) {
SanAdSdk.notifyConsentStatus(context, true);
SanAdSdk.init(this);
}
}
}
else
public class MyApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
if (isMainProcess) {
SanAdSdk.notifyConsentStatus(context, false);
SanAdSdk.init(this);
}
}
}
SanAdSdk.notifyConsentStatus(Context, boolean)
This method can be called multiple times at any time. Especially when the user's permission status has changed, it can be called again.
If your application is aimed at users other than EU users, you need to call
public class MyApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
if (isMainProcess) {
SanAdSdk.notifyConsentStatus(context, true); // important
SanAdSdk.init(this);
}
}
}
Configure Ad Placement in Your App
You should already have created an ad placement on SAN’s site and received an Ad Placement ID. You’ll use it now to identify that ad placementId in your app and request ads from SAN that are relevant for your users.
Once you’ve completed the above steps, you can start displaying ads in your application by configuring the PlacementIds as shown in the link below for your ad format: