AdsPostX offers a react native package designed to help you integrate AdsPostX into your react native mobile application within minutes and start generating more revenue and increasing sales.
npm install rnadspostx
- Init AdsPostX:
const sdkId = 'a359ddi39903994f';
AdsPostXPlugin.init(sdkId, (response) => {
/* if response is true, mean init call is success.
otherwise you will get error with response.*/
}
});
- Load AdsPostX Offers:
const payload = { firstname: 'john', country: 'US' };
AdsPostXPlugin.load((response) => {
/*
if response is 'true' mean offer loaded successfully,
else check 'error' field for error while loading offers.
*/
}, payload);
- Show AdsPostX Offers:
// values used here are just for demo purpose, use actual values when you are integrating SDK.
const showOptions = {
position: {
topMargin: 5.0,
rightMargin: 5.0,
bottomMargin: 5.0,
leftMargin: 5.0,
},
styles: {
transparent: true,
type: 'popup', // OR 'fullscreen',
},
callbacks: {
showCallback: () => {
console.log('Show callback called');
},
errorCallback: (event) => {
console.log('Error callback called:', event);
},
dismissCallback: () => {
console.log('Dismiss callback called');
},
},
};
AdsPostXPlugin.show(showOptions);
- Get Offers
const sdkId = 'YOUR_SDK_ID';
const payload = {
country: 'USA',
firstname: 'Dev',
creative: '1',
dev: '1',
};
try {
const responseData = await AdsPostXPlugin.getOffers(sdkId, payload);
// to access offers
if (responseData.status) {
const offers = responseData.response.data.offers;
}
} catch (error) {
// Handle any errors that occurred during the getOffers call...
}
- Set Environment
AdsPostXPlugin.setEnvironment(0); // for 'live' environment.
OR;
AdsPostXPlugin.setEnvironment(1); // for 'test' environment.
- Set Debug Log
AdsPostx.setDebugLog(true);
OR;
AdsPostx.setDebugLog(false);
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library