Sample code for Rate my App ?

tufanv

Expert
Licensed User
Longtime User
Hello,

I searched for a sample code for "Rate my app" Which will direct users to rate the app but couldnt find one . Does anyone have a sample code for that ?

TY
 

Stulish

Active Member
Licensed User
Longtime User
I have used the code below in an app of mine, The rate.txt file just saves a '1' once the app is rated or a '0' if it has not been rated, then when the your app is opened load the txt file and see if it has already been rated, otherwise it will always ask (which could be annoying)

B4X:
Sub RateMe
If ratemsg = False Then
   Dim result As Int
   result = Msgbox2("If you like this app and think it is useful then please Rate it to support us.","Like this App?", "Rate", "Cancel", "", LoadBitmap(File.DirAssets , "info.png"))
   If result = DialogResponse.POSITIVE Then
      ratemsg = True
      Dim ran As RandomAccessFile 
      ran.Initialize(File.DirInternal,"rate.txt",False)
      ran.WriteInt(1,ran.CurrentPosition)
      ran.Close 
      ratedone = True
      Dim fURI As String
      fURI = "market://details?id=lishsoft.android.saynoto0870"
      Dim Market As Intent
      Market.Initialize(Market.ACTION_VIEW,fURI)
      StartActivity (Market)
      ToastMessageShow("Thanks for rating this app",True)
   Else
      Dim ran As RandomAccessFile 
      ran.Initialize(File.DirInternal,"rate.txt",False)
      ran.WriteInt(0,ran.CurrentPosition)
      ran.Close 
      ratedone = True
   End If
End If
Return ratedone
End Sub

Hope it helps

Stu
 
Upvote 0
Top