mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-19 13:49:20 +00:00
- VERSION 5.02.05
- Se cambio el timer del envio de la ubicacion a 300 seg (5 minutos)
This commit is contained in:
@@ -5238,6 +5238,57 @@ Sub EnviarPDFWhatsAppNumero(NumeroTelefono As String)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub EnviarPDFWhatsAppNumero2(NumeroTelefono As String)
|
||||
If NumeroTelefono.Length = 10 Then NumeroTelefono = "521" & NumeroTelefono ' Agregamos el 521 si es que falta.
|
||||
' Ruta del archivo PDF
|
||||
Dim RutaArchivo As String = Starter.fFileProvider.SharedFolder & "/" & archivoTicketPDF
|
||||
Log(RutaArchivo)
|
||||
|
||||
' Verificar si el archivo existe
|
||||
If File.Exists(Starter.fFileProvider.SharedFolder, archivoTicketPDF) Then
|
||||
' Paso 1: Abrir WhatsApp con el número específico
|
||||
Dim UriWhatsApp As String = "https://wa.me/" & NumeroTelefono
|
||||
Dim IntentWhatsApp As Intent
|
||||
IntentWhatsApp.Initialize(IntentWhatsApp.ACTION_VIEW, UriWhatsApp)
|
||||
|
||||
' Verificar si WhatsApp está instalado
|
||||
' If IntentWhatsApp.ResolveActivity(PackageManager) Is Nothing Then
|
||||
' ToastMessageShow("WhatsApp no está instalado.", True)
|
||||
' Return
|
||||
' End If
|
||||
|
||||
' Iniciar el Intent para abrir WhatsApp
|
||||
StartActivity(IntentWhatsApp)
|
||||
|
||||
' Paso 2: Mostrar un mensaje para compartir el archivo manualmente
|
||||
ToastMessageShow("Por favor, comparte el archivo manualmente en WhatsApp.", True)
|
||||
|
||||
' Esperar un momento para que WhatsApp se abra
|
||||
Sleep(3000)
|
||||
|
||||
' Paso 3: Compartir el archivo desde tu aplicación
|
||||
Dim Uri0 As Object = Starter.fFileProvider.GetFileUri(archivoTicketPDF)
|
||||
|
||||
' Crear un Intent para compartir el archivo
|
||||
Dim Intent1 As Intent
|
||||
Intent1.Initialize(Intent1.ACTION_SEND, "")
|
||||
|
||||
' Establecer el tipo MIME del archivo (PDF)
|
||||
Intent1.SetType("application/pdf")
|
||||
|
||||
' Agregar el URI del archivo al Intent
|
||||
Intent1.PutExtra("android.intent.extra.STREAM", Uri0)
|
||||
|
||||
' Establecer permisos de lectura para la aplicación que recibe el archivo
|
||||
Intent1.Flags = 1 ' FLAG_GRANT_READ_URI_PERMISSION
|
||||
|
||||
' Iniciar el Intent para compartir el archivo
|
||||
StartActivity(Intent1)
|
||||
Else
|
||||
ToastMessageShow("El archivo PDF no existe.", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_envioPDF_Click
|
||||
PDFGENERAR
|
||||
EnviarPDFWhatsAppNumero(et_numeroPDF.Text)
|
||||
|
||||
Reference in New Issue
Block a user