# Startapp questions

**URL:** <https://forums.solar2d.com/t/startapp-questions/348027>\
**Category:** Marketing and Monetization\
**Created:** [July 7, 2018, 4:17am UTC](https://forums.solar2d.com/t/startapp-questions/348027 "2018-07-07T04:17:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 7, 2018, 4:17am UTC](https://forums.solar2d.com/t/startapp-questions/348027/1 "2018-07-07T04:17:26Z")

</div>

So I’ve gotten the startapp plugin to work. I can load&nbsp;interstitial and banner ads, but when I try to load a video ad, nothing happens. (I’m testing on an android device that runs 4.0.4)

Also can I run different types of ads in one game (video, reward,&nbsp;interstitial, etc)? If so how would I do that?

I followed the documentation, and that’s what I’m using in my code.&nbsp;

My game uses the composer library. So what would be the best way to layout the startapp ad code to work on the different composer scenes?&nbsp;

Any other tips and suggestions on using the startapp plugin would be great

&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 7, 2018, 4:24am UTC](https://forums.solar2d.com/t/startapp-questions/348027/2 "2018-07-07T04:24:50Z")

</div>

Also how do I use reward videos? And how do I use it so it will work with&nbsp;interstitial and video ads?

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 7, 2018, 7:10pm UTC](https://forums.solar2d.com/t/startapp-questions/348027/3 "2018-07-07T19:10:50Z")

</div>

Wow those are a lot of questions and you have to give people time to response before nudging especially at the time of your question and your nudge.

But anyway:.

1. Search for the forums, I believe @romaminggamer has some information on how to appropriately&nbsp;deal with ads.

2. Do you have a newer device you can test with? 4.0.4 is very old, I would look for something with at least 4.3

3. Post your code and the logs so we can have a better idea of what is going wrong.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 8, 2018, 2:24am UTC](https://forums.solar2d.com/t/startapp-questions/348027/4 "2018-07-08T02:24:43Z")

</div>

Nudge?

And ok, I’ll check him out.

And no. That’s pretty much the only android device I have.&nbsp;

Also I will post my code here if that will help.

Sorry about the time of my posting, it was day here. Though I am aware of the different time zones.

Thanks&nbsp;

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 8, 2018, 2:33am UTC](https://forums.solar2d.com/t/startapp-questions/348027/5 "2018-07-08T02:33:52Z")

</div>

> centerX = display.contentCenterX
> 
> centerY = display.contentCenterY
> 
> \_W = display.contentWidth
> 
> \_H = display.contentHeight
> 
> local composer = require( “composer” )
> 
> loadsave = require(“lib.loadsave”)
> 
> magnet = require ( “lib.magnet” )&nbsp;
> 
> startapp = require( “plugin.startapp” )
> 
> local function adListener( event )
> 
> &nbsp; &nbsp; if ( event.phase == “init” ) then&nbsp; – Successful initialization
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.provider )
> 
> &nbsp; &nbsp; &nbsp; &nbsp; – Load an StartApp ad
> 
> &nbsp; &nbsp; &nbsp; &nbsp; startapp.load( “interstitial” )
> 
> &nbsp; &nbsp; &nbsp; &nbsp; --tartapp.load( “video” )
> 
> &nbsp; &nbsp; elseif ( event.phase == “loaded” ) then&nbsp; – The ad was successfully loaded
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.type )
> 
> &nbsp; &nbsp; elseif ( event.phase == “failed” ) then&nbsp; – The ad failed to load
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.type )
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.isError )
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.response )
> 
> &nbsp; &nbsp; elseif ( event.phase == “displayed” ) then&nbsp; – The ad was displayed/played
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.type )
> 
> &nbsp; &nbsp; elseif ( event.phase == “hidden” ) then&nbsp; – The ad was closed/hidden
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.type )
> 
> &nbsp; &nbsp; elseif ( event.phase == “clicked” ) then&nbsp; – The ad was clicked/tapped
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.type )
> 
> &nbsp; &nbsp; elseif ( event.phase == “reward” ) then&nbsp; – Rewarded video ad playback completed
> 
> &nbsp; &nbsp; &nbsp; &nbsp; print( event.type )
> 
> &nbsp; &nbsp; end
> 
> end
> 
> – Initialize the StartApp plugin
> 
> startapp.init( adListener, { appId=“”, enableReturnAds = true } )
> 
> – Hide status bar
> 
> display.setStatusBar( display.HiddenStatusBar )
> 
> – Seed the random number generator
> 
> math.randomseed( os.time() )
> 
> –audio.reserveChannels( 1 )
> 
> –audio.setVolume( 0.1, { channel=1 } )
> 
> coinSnd = audio.loadSound(“sounds/moneyPickup.wav”)
> 
> cashRegSnd = audio.loadSound(“sounds/cashRegister.wav”)
> 
> jumpSnd = audio.loadSound(“sounds/whoosh.wav”)
> 
> clickSnd = audio.loadSound(“sounds/buttonClick.wav”)
> 
> hurtSnd = audio.loadSound(“sounds/hurt.wav”)
> 
> –bgMusic = audio.loadStream(“sounds/ninjaWall.wav”)
> 
> audio.setVolume( 0.9, {channel = 2} )
> 
> audio.setVolume( 1, {channel = 3} )
> 
> –setup save file for user
> 
> user = loadsave.loadTable(“user.json”)
> 
> –user = nil
> 
> if(user == nil) then
> 
> user = {}
> 
> user.money = 0
> 
> user.highscore = 0
> 
> user.playsound = true
> 
> user.skin = “ninja”
> 
> user.whiteNinja = false
> 
> user.girlNinja = false
> 
> user.lizardMan = false
> 
> user.robot = false
> 
> user.worker = false
> 
> user.chef = false
> 
> loadsave.saveTable(user, “user.json”)
> 
> end
> 
> – Go to the menu screen
> 
> composer.gotoScene( “menu” )

my main.lua /\

> startapp.show(“interstitial”)

This is how I show my ad /\

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 8, 2018, 3:17am UTC](https://forums.solar2d.com/t/startapp-questions/348027/6 "2018-07-08T03:17:31Z")

</div>

1. To load rewarded you need to do the same as you are doing with interstitial. You can put it right under the request to load the interstitial, but it is usually better to load it closer to the event where the user will have an opportunity for a reward.

2. Then where you want to show it, check to see if it is loaded and show your&nbsp;reward dialog&nbsp;(basically asking the user if they want to watch a video for a reward of xxxx).

3. If the user says yes then show it:

4. Once you get the event.phase&nbsp;= reward call back give the user what you offered for a reward:

5. Remember to load the next reward ad when appropriate or when the last ad is closed.

Hopefully, this response helps you a little.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 8, 2018, 6:38am UTC](https://forums.solar2d.com/t/startapp-questions/348027/7 "2018-07-08T06:38:29Z")

</div>

Ok, thanks. This will help. I’ll give it a try. Just one question. After I show the ad, do I call the adListener function for the “elseif (event.phase == “reward”), or do I write a new if statement?

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 8, 2018, 2:15pm UTC](https://forums.solar2d.com/t/startapp-questions/348027/8 "2018-07-08T14:15:42Z")

</div>

You already have the “reward” statement. You don’t need to write another one. When they finish viewing the video it will just land there so that you can give them the reward.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 9, 2018, 2:42am UTC](https://forums.solar2d.com/t/startapp-questions/348027/9 "2018-07-09T02:42:00Z")

</div>

Ooooh, ok. Thanks.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 9, 2018, 6:25am UTC](https://forums.solar2d.com/t/startapp-questions/348027/10 "2018-07-09T06:25:30Z")

</div>

Do startapp video based ads not work on older devices? Because while interstitial ads work just fine the video based ads don’t show.

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 9, 2018, 2:25pm UTC](https://forums.solar2d.com/t/startapp-questions/348027/11 "2018-07-09T14:25:21Z")

</div>

Rewarded videos or plain interstitial video ads? At least in my experience, the native sdk&nbsp;and the corona sdk&nbsp;does not currently support calling non-rewarded video ads directly. When you ask for an interstitial you will get a mix of static and video ads. I think the documentation should be updated to remove the reference&nbsp;to video&nbsp;ads.

From their documentation about interstitial:

> When integrating this ad type you are open to get both Display or Video ads. Our optimization will auto-select the ad type that will generate the most revenue for you.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 10, 2018, 2:10am UTC](https://forums.solar2d.com/t/startapp-questions/348027/12 "2018-07-10T02:10:13Z")

</div>

Both. But that’s not what I meant. My app won’t even display video/reward ads. There’s no error or crash, it just doesn’t show.

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 10, 2018, 2:41am UTC](https://forums.solar2d.com/t/startapp-questions/348027/13 "2018-07-10T02:41:30Z")

</div>

Add this to the event listener at the top:

```
local function adListener(event) -- you already have this line. local json = require( "json" ) -- add this line print(json.prettify(event)) --add this line 

```

build and deploy to the device and then look and see what the logs say.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 10, 2018, 2:56am UTC](https://forums.solar2d.com/t/startapp-questions/348027/14 "2018-07-10T02:56:48Z")

</div>

Im posting this code to see if it will help.

[lua]local function adListener( event )

&nbsp; &nbsp; if ( event.phase == “init” ) then&nbsp; – Successful initialization

&nbsp; &nbsp; &nbsp; &nbsp; print( event.provider )

&nbsp; &nbsp; &nbsp; &nbsp; – Load an StartApp ad

&nbsp; &nbsp; &nbsp; &nbsp; startapp.load( “interstitial” )

&nbsp; &nbsp; &nbsp; &nbsp; startapp.load( “video” )

&nbsp; &nbsp; elseif ( event.phase == “loaded” ) then&nbsp; – The ad was successfully loaded

&nbsp; &nbsp; &nbsp; &nbsp; print( event.type )

&nbsp; &nbsp; elseif ( event.phase == “failed” ) then&nbsp; – The ad failed to load

&nbsp; &nbsp; &nbsp; &nbsp; print( event.type )

&nbsp; &nbsp; &nbsp; &nbsp; print( event.isError )

&nbsp; &nbsp; &nbsp; &nbsp; print( event.response )

&nbsp; &nbsp; elseif ( event.phase == “displayed” ) then&nbsp; – The ad was displayed/played

&nbsp; &nbsp; &nbsp; &nbsp; print( event.type )

&nbsp; &nbsp; elseif ( event.phase == “hidden” ) then&nbsp; – The ad was closed/hidden

&nbsp; &nbsp; &nbsp; &nbsp; print( event.type )

&nbsp; &nbsp; elseif ( event.phase == “clicked” ) then&nbsp; – The ad was clicked/tapped

&nbsp; &nbsp; &nbsp; &nbsp; print( event.type )

&nbsp; &nbsp; elseif ( event.phase == “reward” ) then&nbsp; – Rewarded video ad playback completed

&nbsp; &nbsp; user.money = user.money + 50

&nbsp; &nbsp; loadsave.saveTable(user, “user.json”)

&nbsp; &nbsp; moneyText.text = user.money

&nbsp; &nbsp; startapp.load(“rewardVideo”)

&nbsp; &nbsp; print( “reward” )

&nbsp; &nbsp; print( event.type )

&nbsp; &nbsp; end

end

– Initialize the StartApp plugin

startapp.init( adListener, { appId="", enableReturnAds = true } )[/lua]

My main.lua updated /\

[lua]local function gotoMenu(event)

if(event.phase == “ended”) then

audio.play(clickSnd, {channel = 2})

physics.stop( )

display.remove(newFlag)

display.remove(newSpear)

display.remove(newCoin)

for i = #objTable, 1, -1 do

table.remove( objTable, i)

break

end

for i = #coinTable, 1, -1 do

table.remove( coinTable, i )

break

end

composer.removeScene(“game”)

composer.gotoScene(“menu”)

–show ad

–if ( startapp.isLoaded( “interstitial” ) ) then

startapp.show(“video”)

–end

end

end[/lua]

Trying to display a video ad, when going back to the menu screen. From my game.lua /\

[lua]local function playAd(event)

&nbsp; if (event.phase == “ended”) then

&nbsp; &nbsp; &nbsp;print( “button works” )

&nbsp; &nbsp; &nbsp;if startapp.isLoaded( “rewardedVideo” ) then

&nbsp; &nbsp; &nbsp;startapp.show(“rewardedVideo”)

&nbsp; &nbsp; &nbsp;end

&nbsp; end

end

startapp.load( “rewardedVideo” )[/lua]

This is my function to show my video reward ad. I have a button that calls it. This is from my shop.lua /\

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 10, 2018, 2:58am UTC](https://forums.solar2d.com/t/startapp-questions/348027/15 "2018-07-10T02:58:28Z")

</div>

ok

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 10, 2018, 3:20am UTC](https://forums.solar2d.com/t/startapp-questions/348027/16 "2018-07-10T03:20:48Z")

</div>

Umm…how do I check the log?

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 10, 2018, 1:40pm UTC](https://forums.solar2d.com/t/startapp-questions/348027/17 "2018-07-10T13:40:54Z")

</div>

As mentioned before this should be “interstitial” and not “video”:

```
--show ad --if ( startapp.isLoaded( "interstitial" ) ) then startapp.show("video") --end end

```

Second you never load a rearded&nbsp;so you need to add rewarded:

```
if ( event.phase == "init" ) then -- Successful initialization print( event.provider ) -- Load an StartApp ad startapp.load( "interstitial" ) startapp.load( "video" ) startapp.load( "rewardedVideo" ) -- Add this line!
```

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 11, 2018, 3:08am UTC](https://forums.solar2d.com/t/startapp-questions/348027/18 "2018-07-11T03:08:01Z")

</div>

I commented out that if statement because I wanted to try a video ad there without the startapp.isLoaded, I know it’s interstitial not video. Also I loaded the reward video elsewhere in my code, But I can’t remember if I tried loading it in the adListener function, I’ll try that. Though like I said before I think it might be the oldness of my device. But I’ll keep trying to change my code around to see if I can get it to work.

---

<div class="post-metadata">

**Author:** ![agramonte](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@agramonte](https://forums.solar2d.com/u/agramonte)\
**Post date:** [July 11, 2018, 3:27am UTC](https://forums.solar2d.com/t/startapp-questions/348027/19 "2018-07-11T03:27:10Z")

</div>

You might be 100% correct and it is the old device that you are using. Where are you located? I can send you a device with a newer OS.

---

<div class="post-metadata">

**Author:** ![ec0](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@ec0](https://forums.solar2d.com/u/ec0)\
**Post date:** [July 11, 2018, 8:16am UTC](https://forums.solar2d.com/t/startapp-questions/348027/20 "2018-07-11T08:16:11Z")

</div>

Ha! That might be a bit difficult, since I live in China. My friend’s got a kindle I could borrow, I want to try it on that. Though I’m not sure it will work, since I’m not sure if startapp supports amazon. But I still need to test my app on a newer device.

[Next page](https://forums.solar2d.com/t/startapp-questions/348027.md?page=2)
