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

9 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

  • 49 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

  • 49 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,714 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: post.html]
#4

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 150 posts
  • Corona SDK

Hi Rob (and Trung);

 

I'm sorry that I am late to this thread.

 

I am busy doing an app update today and I am discovering the reason that Trung has the Chartboost+hasUserConsent problem.

 

Our apps use Chartboost on 3 platforms: Apple, Google Play and Amazon.

 

This is what I have found:

 

a ) On Apple devices, you can pass in the new "hasUserConsent" parameter when you init the plugin. Everything seems fine and ads display as anticipated.

 

b ) On Amazon and Google Android builds, the chartboost.init call fails completely when you include a "hasUserConsent" parameter in the init. This is the error printed out in the console:

 

V/Corona  (10673): Loading via reflection: plugin.chartboost.LuaLoader

I/Corona  (10673): ERROR: chartboost.init(listener, options), Invalid option 'hasUserConsent'
 
Of course I am not altering my init code at all between platforms. It is:
 
chartBoost.init(adMgr.chartBoostListener, {appId = adMgr.cbID, appSig = adMgr.cbSig, hasUserConsent = true})
 
And my build.settings file includes the plugin normally:
 
["plugin.chartboost"] =
       {
           publisherId = "com.coronalabs",
           supportedPlatforms = { ["android-kindle"] = true,  android=true, iphone=true }
       },
 
I am building with Corona version 3335.
 
The steps-to-reproduce should be really simple.
 
1) Build a simple APK and include the Chartboost plugin.
 
2) Add a line of code (and a bare bones listener) to init the plugin and you should see the resulting ERROR message.
 
And, of course, if it won't "init", it won't load or show ads. :-)
 
Steve


[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,714 posts
  • Corona Staff

I'll share this with Engineering.

 

Rob



[TOPIC: post.html]
#6

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 150 posts
  • Corona SDK

Thanks Rob.

 

Steve



[TOPIC: post.html]
#7

Trung Kien Tran

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

  • 49 posts
  • Corona SDK

 

Hi Rob (and Trung);

 

I'm sorry that I am late to this thread.

 

I am busy doing an app update today and I am discovering the reason that Trung has the Chartboost+hasUserConsent problem.

 

Our apps use Chartboost on 3 platforms: Apple, Google Play and Amazon.

 

This is what I have found:

 

a ) On Apple devices, you can pass in the new "hasUserConsent" parameter when you init the plugin. Everything seems fine and ads display as anticipated.

 

b ) On Amazon and Google Android builds, the chartboost.init call fails completely when you include a "hasUserConsent" parameter in the init. This is the error printed out in the console:

 

V/Corona  (10673): Loading via reflection: plugin.chartboost.LuaLoader

I/Corona  (10673): ERROR: chartboost.init(listener, options), Invalid option 'hasUserConsent'
 
Of course I am not altering my init code at all between platforms. It is:
 
chartBoost.init(adMgr.chartBoostListener, {appId = adMgr.cbID, appSig = adMgr.cbSig, hasUserConsent = true})
 
And my build.settings file includes the plugin normally:
 
["plugin.chartboost"] =
       {
           publisherId = "com.coronalabs",
           supportedPlatforms = { ["android-kindle"] = true,  android=true, iphone=true }
       },
 
I am building with Corona version 3335.
 
The steps-to-reproduce should be really simple.
 
1) Build a simple APK and include the Chartboost plugin.
 
2) Add a line of code (and a bare bones listener) to init the plugin and you should see the resulting ERROR message.
 
And, of course, if it won't "init", it won't load or show ads. :-)
 
Steve

 

 

The same error but very long time I did not receive any support



[TOPIC: post.html]
#8

Trung Kien Tran

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

  • 49 posts
  • Corona SDK

Another bug from Chartboost. When your application has Unity Ads & Chartboost => Unity Ads will not show



[TOPIC: post.html]
#9

karpovpw

[GLOBAL: userInfoPane.html]
karpovpw
  • Contributor

  • 242 posts
  • Corona Staff

Hey there, guys!

Looks like there was an internal API naming bug in one of the latest updates, which was slipping from us for quite some time.

Thanks to your feedbacks, updated android version was reuploaded. Make sure to use at least 3313 Corona Simulator build, though.



[TOPIC: post.html]
#10

sbullock

[GLOBAL: userInfoPane.html]
sbullock
  • Contributor

  • 150 posts
  • Corona SDK

Thanks for fixing this.

 

Steve




[topic_controls]
[/topic_controls]