Flutter SDK Installation
Pre-requisites
- Visual Studio Code
- Android Studio (
Iguanaor newer) - Xcode (
26.0or newer) - Obtain client settings from Publift:
TENANT_CODETAG_ID- Google
APPLICATION_ID(Android) GADApplicationIdentifier(iOS)
Installation
- Add
fuseapp_pluginto yourpubspec.yaml
echo 'BrnMk9bbufLlX4Vd' | flutter pub token add https://dart.cloudsmith.io/publift/fuseapp/
flutter pub add fuseapp_plugin --hosted-url https://dart.cloudsmith.io/publift/fuseapp/
- Android Setup
- Add the repository to your
app/build.gradle.kts
repositories {
...
maven { url = uri("https://dl.cloudsmith.io/BrnMk9bbufLlX4Vd/publift/fuseapp/maven/") }
}
If your file is named build.gradle, then use the following syntax:
repositories {
...
maven { url "https://dl.cloudsmith.io/BrnMk9bbufLlX4Vd/publift/fuseapp/maven/" }
}
- Update
AndroidManifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest ... >
<application ... >
<!-- Sample Ad Manager app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="########" />
<meta-data
android:name="com.publift.mobile.TAG_ID"
android:value="########" />
<meta-data
android:name="com.publift.mobile.TENANT_CODE"
android:value="########" />
...
</application>
</manifest>
- iOS Setup
- Add the repository and minimum iOS version at the top of your
Podfile
platform :ios, '15.0'
source 'https://dl.cloudsmith.io/BrnMk9bbufLlX4Vd/publift/fuseapp/cocoapods/index.git'
source 'https://cdn.cocoapods.org/'
- Update
Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Sample Ad Manager App ID: ca-app-pub-9939518381636264~1458516390 -->
<key>GADApplicationIdentifier</key>
<string>########</string>
<key>com.publift.mobile.TAG_ID</key>
<string>########</string>
<key>com.publift.mobile.TENANT_CODE</key>
<string>########</string>
...
</dict>
</plist>
- Add
SKAdNetworkItems- copy and add the contents from here
- Initialize the Plugin
Before loading ads, your app should initialize the Fuse App SDK plugin. This is ideally done right after your app starts.
await FuseAppPlugin.initializeSDK();
- Display a Banner Ad
The following is an example of loading a banner ad.
import 'package:fuseapp_plugin/fuseapp.dart';
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Align(
alignment: Alignment.center,
child: FuseAdView(code: "example_fixed_size_banner"),
)
);
}
}
- Customize your Banner Ad
The following example displays some customization option. See the example app for more detailed examples.
FuseAdView(
code: "example_fixed_size_banner",
params: FuseAdViewParams(
customTargeting: {
"sport": "basketball",
"size": "small"
},
contentUrls: [
"https://www.publift.com/about"
]
),
onEvent: ({event}) {
debugPrint("Fuse Event: $event")
},
)