#Region Project Attributes
#ApplicationLabel: File Provider Test
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalJar: com.android.support:support-v4
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Rp As RuntimePermissions
Dim SharedFolder As String
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.
Private Button1 As Button
Private Label1 As Label
Dim I As Intent
Dim Nb As NotificationBuilder
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")
SharedFolder = Rp.GetSafeDirDefaultExternal("notification")
File.Copy(File.DirAssets,"msgting.mpeg",SharedFolder,"msgting.mpeg")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Dim Uri As String
Dim Dir As String = File.DirRootExternal
Uri = CreateFileProviderUri(SharedFolder ,"msgting.mpeg")
Label1.Text= Uri
Nb.Initialize
Nb.CustomSound = Uri
'Nb.DefaultSound = True
Nb.Notify(10)
End Sub
Sub CreateFileProviderUri (Dir As String, FileName As String) As Object
Dim FileProvider As JavaObject
Dim context As JavaObject
context.InitializeContext
FileProvider.InitializeStatic("android.support.v4.content.FileProvider")
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(Dir, FileName))
Return FileProvider.RunMethod("getUriForFile", Array(context, Application.PackageName & ".provider", f))
End Sub