I have made an android app and I want to show exit ad. I have 3 ad networks. I want to pass a parameter from server to choose between these networks.
Lets say, I give edge to
adnetwork 1 = 50%
adnetwork 2, 40%
dnetwork 3, 10%
and I want to distribute traffic in this order. That's it should allocate
50% traffic to adnetwork 1
40% to adnetwork 2
10% to adnetwork 3
I know about mediation networks but it doesn't work with adnetwork 1. So, I don't want to use ad mediation.
I found a solution to this problem, it works. I hope it helps someone else too.
// Get a random number <= 100
Random r = new Random();
Integer n = r.nextInt(100);
// Get the network allocations
Integer allocation_network1 = 50;
Integer allocation_network2 = 40;
Integer allocation_network3 = 10;
// Choose which network to use
if (n <= allocation_network1) {
// Display ad network1 Ad
}
else if (n <= allocation_network1 + allocation_network2) {
// Display ad network2 Ad
}
else if (n <= allocation_network1 + allocation_network2 + allocation_network3){
}