Integrate the SAN SDK - san-sdk/sample GitHub Wiki
- Use Android Studio 3.2 or higher
- Support androidX
- minSdkVersion 16 or higher
- compileSdkVersion 30 or higher
The SAN Open SDK is available as an AAR via mavenCentral.To add the san-sdk dependency, open your project and update the app module’s build.gradle
to have the following repositories
and dependencies
:
repositories {
// ... other project repositories
mavenCentral()
}
//...
dependencies {
// ... other project dependencies
api "com.myadsget:san-sdk:${LATEST_VERSION}"
}
You should get the LATEST_VERSION from CHANGELOG
To support Java 8, add the language feature support:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Update your AndroidManifest.xml
in order to complete the SDK integration. Add the following permissions and activity declarations according to the bundle you are integrating.
- Declare the following permissions:
<!-- Required permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Optional permissions. Will pass Lat/Lon values when available. Choose either Coarse or Fine -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- Add
meta-data
andqueries
<manifest>
<application>
<meta-data android:name="com.san.APP_KEY"
android:value="YOUR_APP_KEY"/>
</application>
</manifest>
Oct 01, 2020 - Android 9.0 (API 28) blocks cleartext (non-HTTPS) traffic by default, which can prevent ads from serving correctly. To mitigate that, publishers whose apps run on Android 9.0 or above should ensure to add a network security config file. Doing so allowlists cleartext traffic and allows non-HTTPS ads to serve.
- In your AndroidManifest.xml file, add the following:
<manifest>
<application
...
android:networkSecurityConfig="@xml/network_security_config"
...>
</application>
</manifest>
- In your
network_security_config.xml
file, add abase-config
that setscleartextTrafficPermitted
totrue
:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
...
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
...
</network-security-config>