Android Question Detect Admob was clicked

Rizal Putra

Member
Licensed User
Longtime User
Sorry, but it's not what i want.
I just want to count how much user was click Admob.
Because i want if user was click 1000 times, Admob view will be removed / not loaded.
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
Sorry, but it's not what i want.
I just want to count how much user was click Admob.
Because i want if user was click 1000 times, Admob view will be removed / not loaded.


hmm ok;)

make this

add this class
http://www.b4x.com/android/forum/th...efficient-key-value-data-store.26317/#content

later add this code
B4X:
Sub Process_Globals
    Dim kv As KeyValueStore
End Sub


Sub Activity_Create(FirstTime As Boolean)
If File.Exists(File.DirDefaultExternal, "yourfolder" ) = False Then
    File.MakeDir(File.DirDefaultExternal, "yourfolder")
    FP = File.Combine(File.DirDefaultExternal,"yourfolder")
    Else
    FP = File.Combine(File.DirDefaultExternal,"yourfolder") 'note you can change file.dir and youfoldername
    End If
kv.Initialize(FP, "data") 'this is your database you can change the name

End Sub

later u need know how to get the click on adbox-adview
in this function you can add code like this

B4X:
dim teste as string
if kv.ContainsKey("admobclicks") = true then
teste = kv.GetSimple("admobclicks")
kv.putsimple("admobclicks", teste +1) 'example
else
kv.putsimple("admobclicks", 1)
end if

this go insert +1 on db where key is admobclicks
you can get this value every time you want with
kv.GetSimple("admobclicks") 'it show you the result on db where key is admobclicks

sory for my english
 
Upvote 0
Top