Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private rp As RuntimePermissions
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
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")
'rp.CheckAndRequest("android.permission.WRITE_SETTINGS")
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result=False Then
Msgbox("false.." ,"")
End If
If File.Exists(File.DirRootExternal,"audi")=False Then
File.MakeDir(File.DirRootExternal,"audi")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
If Not(rp.Check(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)) Then
Msgbox("No permission.." ,"")
Else
Dim r As RingtoneManager
Dim u As String
If File.Exists(File.DirRootExternal&"/audi", "1.mp3") = False Then
File.Copy(File.DirAssets, "1.mp3", File.DirRootExternal&"/audi", "1.mp3")
End If
Try
u = r.AddToMediaStore(File.DirRootExternal&"/audi", "1.mp3", "1.mp3", False, False, True, False)
File.WriteString(File.DirInternal, "ur1.txt", u)
Catch
u = File.ReadString(File.DirInternal, "ur1.txt")
End Try
r.SetDefault(r.TYPE_RINGTONE, u)
End If
End Sub