Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ad As RewardedVideoAd
Dim dato As RandomAccessFile
Dim fecha As Long
Dim intentos As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
ad.Initialize("ad")
intentos=0
End Sub
Sub Activity_Resume
ad.LoadAd("ca-app-pub-9543716757242777/7172194814")
Msgbox2Async("Ici, après d'avoir vu un petit vidéo, vous aurez l'app libre de publicité pour un mois. Voulez vous continuer?","Se débarraser de la publicité","Oui","","Non",Null,False)
Wait For MsgBox_Result (result As Int)
If result = DialogResponse.NEGATIVE Then
Activity.Finish
End If
End Sub
Sub ad_ReceiveAd
ad.Show
End Sub
Sub Ad_Rewarded (Item As Object)
fecha=DateTime.Now
File.OpenOutput(File.DirDefaultExternal,"data.txt",False)
dato.Initialize(File.DirDefaultExternal,"data.txt",False)
dato.WriteLong(fecha,0)
dato.Close
Msgbox("Vous avez gagné un mois sans publicité! Merci","Fini")
StartActivity(Main)
End Sub
Sub Ad_FailedToReceiveAd (ErrorCode As String)
If intentos<30 Then
Log("Failed: " & ErrorCode)
ad.LoadAd("ca-app-pub-9543716757242777/7172194814")
intentos=intentos+1
Else
Msgbox("Il y a quelques problèmes","Problèmes")
Activity.Finish
End If
End Sub
Sub Ad_AdClosed
End Sub
Sub Ad_AdOpened
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub