How do I program a mobile app to send SMS? - vb.net

I want a mobile app to send automated SMS. This will be in VB.Net. I've searched for articles on these but they are all about PC apps accessing a GSM modem or a mobile through a COM port. Is it the same process with mobile apps on the phone (not through a PC)? If yes, and I am to treat the GSM modem as a "port", how would I connect to it? If no, are there any useful resources for this?

Sending SMS is easy with windows mobile. You need a reference to mobile.poutlook namespace.
"Send SMS from Pocket PC, SMartphones, Windows mobile
To send an SMS Message we’ll first need to make reference to the Microsoft.WindowsMobile.PocketOutlook namespace.
Imports Microsoft.WindowsMobile.PocketOutlook
After that it’s as simple as creating a new instance of the SMSMessage class with an overloaded onstructor passing in the Recipient Mobile number and SMS text, then invoking the Send method"
Source.
Download VB code directly.
MS reference.
MS Snippet:
public void SmsMessageSend()
{
SmsMessage smsMessage = new SmsMessage();
//Set the message body and recipient.
smsMessage.Body = "Would you like to meet for lunch?";
smsMessage.To.Add(new Recipient("John Doe", "2065550199"));
smsMessage.RequestDeliveryReport = true;
//Send the SMS message.
smsMessage.Send();
return;
}
An automated VB translation of the above snippet:
Public Sub SmsMessageSend()
Dim smsMessage As New SmsMessage()
'Set the message body and recipient.
smsMessage.Body = "Would you like to meet for lunch?"
smsMessage.To.Add(New Recipient("John Doe", "2065550199"))
smsMessage.RequestDeliveryReport = True
'Send the SMS message.
smsMessage.Send()
Return
End Sub
The above is not VB as asked, but unfortunately MS does not provide the VB snippet there.
All this will only work, if you are using a windows mobile device. It will not work on windows ce devices.
You should consider your internet searches for mobile API and code. I always start with "compact framework" to get code related results only. Then I add the keywords I search for. In example: "compact framework send sms" gives a good result list that you can work on.

Related

Is my Idea possible in VB.Net ? If no which lang should I take

I have a nice Idea in my head.
Im thinking about writing an application in VB.Net, that can control USB ports.
The purpose will look like:
Im at home, I wannt a ready hot coffee as Im in my office. So i take my phone and I write a mail to adres (example) IWanntMyCoffe#gmail.com. The body of the mail is "DO_A_Coffee"
The application, running on my laptop in the office gets the mail.
It recognizes the string "DO_A_COFFEE" and uses the usb port to activate the prepared Machine to make my coffee.
I know that VB.NET has a tool for USB connections, but I have no experience with that.
But at all, is this even possible in vb.net?
found with Google (VB.NET Serial port)
Sub SendSerialData(ByVal data As String)
' Send strings to a serial port.
Using com1 As IO.Ports.SerialPort =
My.Computer.Ports.OpenSerialPort("COM1")
com1.WriteLine(data)
End Using
End Sub

Is it possible to write an equivalent of SMSSecure for Windows Phone?

Is there an API for any version of Windows Phone that allows an application to sniff incoming SMS messages and transparently send ones, replacing the built-in SMS application with one that supports encryption like an Android's SMSSecure does?
You can't override basic apps on Windows Phone. You can't modify Contacts, Photos, Messages, Calendar...
If you want to send a SMS message you can use these lines of code:
Windows.ApplicationModel.Chat.ChatMessage msg = new Windows.ApplicationModel.Chat.ChatMessage();
msg.Body = "Hello d33tah. Nice to see you on stackoverflow!";
msg.Recipients.Add("10086");
msg.Recipients.Add("10010");
await Windows.ApplicationModel.Chat.ChatMessageManager.ShowComposeSmsMessageAsync(msg);
You can read this article in order to get more information.

how to hide http request using vb.net

I'm developing new app. This is app need to get information from my website so I use HTTP request using vb.net.
Sub Main()
'Address of URL
Dim URL As String = http://whatever.com
' Get HTML data
Dim client As WebClient = New WebClient()
Dim data As Stream = client.OpenRead(URL)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = ""
str = reader.ReadLine()
Do While str.Length > 0
Console.WriteLine(str)
str = reader.ReadLine()
Loop
My problem is , I found an app called fiddler http://www.fiddler2.com/fiddler2/
This app could find all HTTP request that maked using my app , so this put my website at risk.
Is There any way how to hide HTTP request from been detected ????
I'm not familiar with this "fiddler" product, but just from reading the page that you reference, it is something that runs on the user's machine and monitors traffic between that computer and the Internet. I don't see how it would be even theoretically possible to prevent this. Signals are moving over wires leaving the user's computer. He presumably has physical access to his own computer. If nothing else, he could attach something to the cable coming out the back of the computer that monitors the signals moving over the wire.
You could encrypt messages so that it's difficult for the user to interpret what they mean, but you can't stop him from reading the message as it was sent.
I wonder, by the way, how it is a security problem for a user to know what messages are being sent from his own computer. Are you trying to hide what you are doing from the person using your program? Frankly, if I discovered that an application I have on my computer was trying to hide what it was doing from me, I would immediately delete it. Why would someone want to hide what he's doing to MY computer unless what he is doing is something sinister, trying to steal my personal data or some such?
Just to be slightly sarcastic, your question sounds a little like asking, When I visit a business associate, how can I prevent him from finding out out what I did in his office when he stepped out for a few minutes?
There is a way using the Proxy method just add this Code in the HTTP request:
Request.Proxy = New WebProxy()
cause how fiddler works it sets itself as the proxy using the above code it cannot set fiddler proxy and thats how you stop it from reading anything

Line break problems sending SMS through SMTP ftrom VB.NET

I wrote a VB.NET application to send notifications by SMS using an SMTP gateway (mobilenumber#mobileprovider.com).
The message includes line breaks and display well under most providers but not all.
For some providers, the message will display in one line with line breaks showing as "0D0A" which just won't work for me.
Is therea solution to this problem?
Using an SMS agregator is out of the question for my solution.
Yes, I did that. Turned out to be carrier specific.
Yet another problem i am having is specific to the phone model (one specific user receive the messages well on his old razor, changed to a new motorola phone with the same carrier and now receives an empty message).
Any ideas ?
This is neither vb.net or smtp problem.
It sure looks like it is mobile provider specific. Try checking your (mail message) encoding - have you tried pure ASCII?
If I'm not mistaken 0D0A is UTF-8 for line break...

Help with sending text thou TCP/IP or LAN

Hey all i am trying to send a text message from a virtual machine (VMWARE) to my local machine so that i can hit a button in the VM and have it do something on the local.
Is there anyway to send a text through an IP, TCP/IP, LAN using VB6 or VB.net? I was looking at the net send to send something but it doesn't seem to work for me (as well as it seems to pop up a dialog box for every text you send). I've already tried this out:
http://www.codeproject.com/KB/vb/CfSimpleSendComp.aspx
But it doesn't seem to work at all on my computer? I've tried both the IP of the machine and also the computer's name. Maybe .NET Remoting in VB?
Could anyone let me know if there are other ways to do what i would like to do?
Thanks!
David
You also can consider to use Eneter Messaging Framework.
It is lightweight and very easy to use.
I am sorry, I am not familiar with VB syntax, but in C# the whole implementation
is here: (You can copy paste the code into your project, include Eneter.Messaging.Framework.dll and change the IP to yours.)
The server listening to string messages.
using System;
using Eneter.Messaging.EndPoints.StringMessages;
using Eneter.Messaging.MessagingSystems.MessagingSystemBase;
using Eneter.Messaging.MessagingSystems.TcpMessagingSystem;
namespace StringReceiver
{
class Program
{
static void Main(string[] args)
{
// Create Tcp based messaging.
IMessagingSystemFactory aTcpMessaging = new TcpMessagingSystemFactory();
IInputChannel anInputChannel = aTcpMessaging.CreateInputChannel("127.0.0.1:7091");
// Create string message receiver
// Note: it is possible to receiver typed messages too.
IStringMessagesFactory aStringMessagesFactory = new StringMessagesFactory();
IStringMessageReceiver aStringMessageReceiver = aStringMessagesFactory.CreateStringMessageReceiver();
aStringMessageReceiver.MessageReceived += StringMessageReceived;
// Attach the input channel to the string message receiver
// and start listening.
Console.WriteLine("String sercer is listening.");
aStringMessageReceiver.AttachInputChannel(anInputChannel);
}
// Processing messages.
static void StringMessageReceived(object sender, StringMessageEventArgs e)
{
Console.WriteLine("Received message: " + e.Message);
}
}
}
The client sending the string messages:
using Eneter.Messaging.EndPoints.StringMessages;
using Eneter.Messaging.MessagingSystems.MessagingSystemBase;
using Eneter.Messaging.MessagingSystems.TcpMessagingSystem;
namespace StringMessageSender
{
class Program
{
static void Main(string[] args)
{
// Create Tcp based messaging.
IMessagingSystemFactory aTcpMessaging = new TcpMessagingSystemFactory();
IOutputChannel anOutputChannel = aTcpMessaging.CreateOutputChannel("127.0.0.1:7091");
// Create string message receiver
// Note: it is possible to receiver typed messages too.
IStringMessagesFactory aStringMessagesFactory = new StringMessagesFactory();
IStringMessageSender aStringMessageSender = aStringMessagesFactory.CreateStringMessageSender();
// Attach the output channel to the string message sender
// so that we can send messages via Tcp to desired Ip address.
aStringMessageSender.AttachOutputChannel(anOutputChannel);
// Send message.
aStringMessageSender.SendMessage("Hello world.");
}
}
}
Eneter Messaging Framework can be downloaded at www.eneter.net.
If you would like to get more technical info: www.eneter.net/OnlineHelp/EneterMessagingFramework/Index.html
More examples: eneter.blogspot.com
You need a client and a server, one of them at each end. These could communicate over TCPIP (TCP or UDP), Microsoft Networking (named Pipes, Mailslots), or whatever you have. Some options depend on what OS the two machines are running, but since you mentioned NET SEND we can probably assume some flavor of Windows.
The Messenger Service is gone in later versions of Windows NT (Vista, Windows 7) so it's not the best option. There are other Mailslots messengers though as well as lots of UDP messengers.
The real question is what action you want to perform "at the push of a button." Heck, you could easily run Telnet if that gave you what you were after.
Don't forget you may have to open firewalls for any of these to work though.
.Net Remoting isn't available in VB, you must mean VB.Net. That's a remote object invokation technology though and probably not what you want.
You'd probably get to a result more quickly picking one development tool set and using whatever it offers for TCP or UDP sockets.
There are several ways. The best way depends on how you define 'text message'.
If you literally just need to hit a button and run a command on a remote machine, I would run PsExec in Process object. Cheesy but effective. Something like:
Using p as new Process()
p.StartInfo.FileName = "c:\path\to\PsExec.exe"
p.StartInfo.Arguments = "\\RemoteComputerName RemoteCommand.exe"
p.Start()
End Using
If you need bi-directional communication with a custom protocol, I would use WCF or the TCPListener and TCPClient classes to create your own socket server and client.
I would stay away from remoting.