Private Sub Application_Active
If IsLaunchedFromNotification Then
If Not(ScheduledMessagesPage.Visible) Then 'bring this page to the top before attempting to set it as a parent of messagecomposer
NavControl.ShowPage(ScheduledMessagesPage)
End If
Log("Notification.Tag = " & LaunchingNotification.Tag) 'prints nil
HandleTextNotificationLaunch(LaunchingNotification.Tag)
LaunchingNotification.Cancel
End If
End Sub
Sub Application_ReceiveLocalNotification (LN As Notification)
'this event will fire if the scheduled notification happend when the app was running
Log("launched while app is running. LN.TAG = " & LN.Tag) 'prints nil
IsLaunchedFromNotification = True
LaunchingNotification = LN
End Sub
........
Sub HandleTextNotificationLaunch(key As String)
Dim mc As MessageComposer
mc.Initialize("MessageComposer")
If mc.CanSendText Then
Log("Before getting pending message. key: " & key) 'prints nil
Dim pm As PendingMessage = MessageStore.GetSavedMessage(key) 'fails here
Log("Composing text: " & pm.StrMessage & ", to: " & pm.StrTo)
mc.SetRecipients(Array As String(pm.StrTo))
'mc.SetRecipients(Array As String("Haris"))
mc.Body = pm.StrMessage
'mc.Body = "Test message body"
mc.Show(ScheduledMessagesPage)
Else
Log("Can't send TEXTS :(")
End If
End Sub