How do I change advertising company without making a new apk and updating the application.

Hello there,

I need to know quite badly due to drops in ecpm rates and lack of campaigns how I would change advertising companies for an application without updating the entire application.

to me it seems very complicated but I am certain you guys have an easy fix/solution.

Thank You,

James

If you have your own server, you can read a simple text file from that server with a value in it.

For instance, my apps supports 3 networks. When the app starts, I read a textfile ‘ads.txt’ from the server, and retrieve the value (1,2 or 3). Depending on that value i use a different ad network.

To change networks, just edit the ‘ads.txt’ on your server to a different number and voila.

Sample:

function CheckInternet() if require("socket").connect("google.com", 80) == nil then \_G.Internet = 0 else \_G.Internet = 1 end end CheckInternet() print("Internet: "..\_G.Internet) local function networkListener( event ) if ( event.isError ) then print( "Network error!") \_G.providerForBannerAds = "revmob"; elseif ( event.phase == "began" ) then if event.bytesEstimated \<= 0 then --print( "Download starting, size unknown" ) else --print( "Download starting, estimated size: " .. event.bytesEstimated ) end elseif ( event.phase == "progress" ) then if event.bytesEstimated \<= 0 then --print( "Download progress: " .. event.bytesTransferred ) else --print( "Download progress: " .. event.bytesTransferred .. " of estimated: " .. event.bytesEstimated ) end elseif ( event.phase == "ended" ) then print( "Download complete, total bytes transferred: " .. event.bytesTransferred ) local path = system.pathForFile( "ads-fw.txt", system.DocumentsDirectory ) local file = io.open( path, "r" ) local savedData = file:read( "\*a" ) io.close( file ) file = nil if savedData == nil then \_G.providerForBannerAds = "revmob"; else if tonumber(savedData) == 1 then \_G.providerForBannerAds = "revmob"; else \_G.providerForBannerAds = "admob"; end end print("Advertiser: "..\_G.providerForBannerAds) end end local params = {} -- This tells network.request() that we want the 'began' and 'progress' events... params.progress = "download" -- This tells network.request() that we want the output to go to a file... params.response = { filename = "ads-fw.txt", baseDirectory = system.DocumentsDirectory } function CheckAdvertiser() network.request( "https://www.rmbsoft.com/ads-fw.txt", "GET", networkListener, params ) end if \_G.Internet == 1 then timer.performWithDelay( 120000, CheckAdvertiser,0 ) CheckAdvertiser() end

Thanks for sharing this great example.

If you have your own server, you can read a simple text file from that server with a value in it.

For instance, my apps supports 3 networks. When the app starts, I read a textfile ‘ads.txt’ from the server, and retrieve the value (1,2 or 3). Depending on that value i use a different ad network.

To change networks, just edit the ‘ads.txt’ on your server to a different number and voila.

Sample:

function CheckInternet() if require("socket").connect("google.com", 80) == nil then \_G.Internet = 0 else \_G.Internet = 1 end end CheckInternet() print("Internet: "..\_G.Internet) local function networkListener( event ) if ( event.isError ) then print( "Network error!") \_G.providerForBannerAds = "revmob"; elseif ( event.phase == "began" ) then if event.bytesEstimated \<= 0 then --print( "Download starting, size unknown" ) else --print( "Download starting, estimated size: " .. event.bytesEstimated ) end elseif ( event.phase == "progress" ) then if event.bytesEstimated \<= 0 then --print( "Download progress: " .. event.bytesTransferred ) else --print( "Download progress: " .. event.bytesTransferred .. " of estimated: " .. event.bytesEstimated ) end elseif ( event.phase == "ended" ) then print( "Download complete, total bytes transferred: " .. event.bytesTransferred ) local path = system.pathForFile( "ads-fw.txt", system.DocumentsDirectory ) local file = io.open( path, "r" ) local savedData = file:read( "\*a" ) io.close( file ) file = nil if savedData == nil then \_G.providerForBannerAds = "revmob"; else if tonumber(savedData) == 1 then \_G.providerForBannerAds = "revmob"; else \_G.providerForBannerAds = "admob"; end end print("Advertiser: "..\_G.providerForBannerAds) end end local params = {} -- This tells network.request() that we want the 'began' and 'progress' events... params.progress = "download" -- This tells network.request() that we want the output to go to a file... params.response = { filename = "ads-fw.txt", baseDirectory = system.DocumentsDirectory } function CheckAdvertiser() network.request( "https://www.rmbsoft.com/ads-fw.txt", "GET", networkListener, params ) end if \_G.Internet == 1 then timer.performWithDelay( 120000, CheckAdvertiser,0 ) CheckAdvertiser() end

Thanks for sharing this great example.