Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Chartboost for Android not show ads & repost error
Started by Trung Kien Tran Jul 17 2018 06:19 PM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Trung Kien Tran

[GLOBAL: userInfoPane.html]
Trung Kien Tran
  • Enthusiast

  • 47 posts
  • Corona SDK

I use Chartboost in my Android app. I have enabled the hasUserConsent variable. However, my app does not display ads. Repost Page on Chartboost do not coincide with my app installs on the Google Play Developer Console
The same project, the iOS platform still works normally
Please view image attach file
ca5da2db57b23b898a7f98ba9864ea12.PNG
44567314d83e670665673dcffcc26f69.jpg

Attached Files



[TOPIC: post.html]
#2

Trung Kien Tran

[GLOBAL: userInfoPane.html]
Trung Kien Tran
  • Enthusiast

  • 47 posts
  • Corona SDK

This is my code:

main.lua

local chartboost = require( "plugin.chartboost" )
-- Chartboost listener function
local function adListener( event )
 
    if ( event.phase == "init" ) then  -- Successful initialization
        chartboost.load( "interstitial" )
 
    elseif ( event.phase == "loaded" ) then
        if ( event.type == "interstitial" ) then
            chartboost.show( "interstitial" )
        end
    end
end
 
-- Initialize the Chartboost plugin
chartboost.init( adListener, {hasUserConsent = true, appId="5b4c0151a9a7760c2fe76a2c", appSig="8a1e0a83d42dd1ec1a7e96476aecb8630a91e334" } )


local widget = require( "widget" )
 
-- Function to handle button events
local function handleButtonEvent( event )
 
    if ( "ended" == event.phase ) then
	chartboost.show( "interstitial" )
        print( "Button was pressed and released" )
    end
end
 
-- Create the widget
local button1 = widget.newButton(
    {
        left = 100,
        top = 200,
        id = "button1",
        label = "Show ads",
        onEvent = handleButtonEvent
    }
) 

build.settings

settings =
{
	android =
	{
		usesPermissions =
		{
			"android.permission.INTERNET",
			"android.permission.INTERNET",
			"android.permission.ACCESS_NETWORK_STATE",
			"android.permission.WRITE_EXTERNAL_STORAGE",
			"android.permission.ACCESS_WIFI_STATE",
			"android.permission.READ_PHONE_STATE" ,
		},
	},

	plugins =
	{
		["plugin.chartboost"] =
				{
					publisherId = "com.coronalabs"
				},
	},

	excludeFiles =
	{
		all = { "Icon.png", "Icon-*dpi.png", "Images.xcassets", },
		android = { "LaunchScreen.storyboardc", },
	},
}
 

My Project: http://tabs.vn/cbtest.zip

 

I was disappointed because there was no support from Corona for this question
 



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,331 posts
  • Corona Staff

This is a question I had hoped a community developer who uses Chartboost on a daily basis would have some advice for you. While our developer has a test account, we don't run production ads from Chartboost anywhere.

 

Next, you are not printing out any data in your adListener function. You can't know what's going on with your ads if you don't print the event table and tether your device to your computer and monitor the device's console log.

I would require the JSON library and then at the very top of adListener print the table:

local chartboost = require( "plugin.chartboost" )
local json = require( "json" )

-- Chartboost listener function
local function adListener( event )
    print( json.prettify( event ) )
    if ( event.phase == "init" ) then  -- Successful initialization
        chartboost.load( "interstitial" )
 
    elseif ( event.phase == "loaded" ) then
        if ( event.type == "interstitial" ) then
            chartboost.show( "interstitial" )
        end
    end
end 

You might want to make sure all your ID's and such are correct too and that you're not in test mode. I don't know if Chartboost uses different ID's for iOS and Android, but your code sample above doesn't show any compensation for that if that's a Chartboost requirement. Most Ad providers require different App ID's for different platforms.

 

When you're able to capture the console log from a device with the prints, post what's being logged back here and we can see why you're not getting ads.

 

Rob




[topic_controls]
[/topic_controls]