Android Question Intent PutExtra & GetExtra

Erind Jushaj

Licensed User
I am trying to connect 2 app where I first declare a string on the first app and i want this string to be read on the second app but I cant make this work apparently.
I even put a Msgbox to see if it returns anything but even that does not work..

1. Is something wrong with the code
2. How can I debug both programs at the same time to see how they interact?

Simplified Code first app:
Dim in As Intent
                Dim pm As PackageManager
                in = pm.GetApplicationIntent("b4a.TelegramBot")
                in.PutExtra("android.intent.extra.BotMessage","String I want on second app")
                If in.IsInitialized Then StartActivity(in)
                End If

Code second app which should read the Extra:
#Region  Project Attributes
    #ApplicationLabel: TeleBot
    #VersionCode: 1
    #VersionName: 1.0
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

Sub Process_Globals

    Dim Bot As SMMTeleBot
    Dim StartingIntent As Intent
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
    StartingIntent = Activity.GetStartingIntent
    Dim BotMessage As String
    BotMessage = StartingIntent.GetExtra("android.intent.extra.BotMessage")
    If BotMessage <> Null Then
    Msgbox(BotMessage,"not null")
    End If
    Bot.Initialize("This part is correct as it works when I dont have the Intent", "BOT", 120, 120, 120)
    Bot.sendMessage("This part is correct as it works when I dont have the Intent", BotMessage, 0, 0, Null)

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Licensed User
Upvote 0