DotNet Messaging

Download "DotNet Messaging" android application to your phone. Install "NerdsInn.Messaging" package in your project.And enjoy sending & reciving SMS from your phone using .net applicaions.

Download Android Application

Updates are comming in android application this week. Which will allow you some new features.Be updated.

Introduction

"DotNet Messaging" have two main components. The android application "DotNet Messaging" & .net package "NerdsInn.Messaging". Which let developers send sms from their .net application using their android mobile device. Currently usually a GSM modem or old GSM supported mobile phones are used in conjunction with .net application to send messages to contacts, but now anyone can connect their android mobile phone with .net application to send messages to the intended person.

Features

  • Easy Integration with .net technologies such as C#, VB.net etc.
  • Send SMS from your smartphone/tablets by using .net code in your application
  • Receive SMS from your smartphone/tablets to your .net application
  • Connect to your PC through Wifi , USB cable or any local network
  • Connect multiple devices to single Instance/PC
  • Fast Sending and Receiving SMS

Installation

Step: 1

Download and install DotNet Messaging android applicaton to your smart phone from playstore.

Step: 2

Open "Package Manager Console" Window In Visual Studio. And run the below command.This Package is hosted on nuget.org

                    
Install-package NerdsInn.Messaging
                    
                

Demo

Example code for window form application in c#


// use NerdsInn.Messaging namespace at the top of your project.
private void Form1_Load(object sender, EventArgs e)
{
SMSController smsController = new SMSController();
//SMSController smsController = new SMSController(3333); Connection on different port
//SMSController smsController = new SMSController("192.168.8.10",3333); Connection on different IP & different port(In case of multiple NetworkInterfaces)
var isWatching = smsController.StartWatching();
if (isWatching)
{
smsController.OnDeviceConnected += SMSController_OnDeviceConnected;
smsController.OnDeviceDisconnected += SMSController_OnDeviceDisconnected;
smsController.OnMessageReceived += SMSController_OnMessageReceived;
smsController.OnPassCodeVerified += SMSController_OnPassCodeVerified;
smsController.OnMessageSent += SMSController_OnMessageSent;
smsController.OnDeviceUnblocked += SMSController_OnDeviceUnblocked;
smsController.OnDeviceBlocked += SMSController_OnDeviceBlocked;
}
}

private void SMSController_OnMessageSent(object sender, SMSController.SMS sms)
{
MessageBox.Show("Message Sent to : " + sms.address);
}

private void SMSController_OnPassCodeVerified(object sender, SMSController.Device device)
{
MessageBox.Show("PassCode Verified Successfully on "+ device.imei);
}

private void SMSController_OnMessageReceived(object sender, SMSController.SMS sms)
{
MessageBox.Show("Message Received : " + sms.body);
}

private void SMSController_OnDeviceDisconnected(object sender, SMSController.Device device)
{
MessageBox.Show(device.imei + " - Disconnected");
}

private void SMSController_OnDeviceUnblocked(object sender, SMSController.Device device)
{
MessageBox.Show(device.imei + " - UnBlocked");
}
private void SMSController_OnDeviceBlocked(object sender, SMSController.Device device)
{
MessageBox.Show(device.imei + " - Blocked");
}

Requirements

  • .Net framework 4.5 or higher
  • Administrator privileges are required

Downloads



Note: We are using smsController with events and function in this documentation. which is an instance of SMSController.
                    
SMSController smsController = new SMSController();   
                    
                

Events

smsController.OnDeviceConnected

Triggered when a new device is connected to the system:

Provide the device object which is an instance of SMSController.Device clase.This object provide information about the connected device. Also you have the ability to perform below action on that device

  • You can send SMS to that device by device.SendSMS(SMSController.SMS sms)
  • You can add device to verified devices list device.Verify(SMSController smsController)
  • You can add that device to block devices list device.Block(SMSController smsController)
  • You can send passcode to that device device.RequestPassCode(string passcode)
  • You can also disconnect the connected device by calling device.Disconnect(SMSController smsController)

smsController.OnDeviceDisconnected

Called when a connected device disconnected.

smsController.OnMessageReceived

Triggered on arrival of a new SMS.

Provide the SMS object which is an instance of SMSController.SMS class. This object provide information about the new SMS & it device.

smsController.OnMessageSent

Triggered when sms sent successfully.

smsController.OnDeviceBlocked

Triggered when device blocked successfully.

smsController.OnDeviceUnblocked

Triggered when device unblocked.

smsController.OnPassCodeVerified

Triggered when device passcode matched to server passcode.

Functions

SMSController()

SMSController(Int32 Port=3000)

SMSController(string Ip,Int32 Port=3000)

SMSController(IPEndPoint _IPEndPoint)

This is the constructor of the "SMSController" class has three overloaded methods. You can pass custom port number and custom IP if you want to start communication on different Ip & Port.

smsController.StartWatching()

public bool StartWatching()

Application start watching for any activity on the given port.

smsController.GetDeviceByIMEI()

public Device GetDeviceByIMEI(Int64 IMEI)

This function will return a device from connected devices by IMEI number.

smsController.GetDeviceByConnecionId()

public Device GetDeviceByConnecionId(string ConnectionId)

This function will return a device from connected devices by ConnectionId.

smsController.AllConnectedDevices()

public List AllConnectedDevices()

It will return the list of all connected devices.

smsController.AllVerifiedDevices()

public List AllVerifiedDevices()

It will return list of all devices that are verified.

smsController.AllBlockedDevices()

public List AllBlockedDevices()

It will return list of all devices that has been blocked.

smsController.GetAddress()

public string GetAddress()

This function will return the full address which is using for communication.

smsController.GetIP()

public IPAddress GetIP()

This function will return the ip address part from the address which is using for communication.

smsController.GetPort()

public IPEndPoint GetPort()

This function will return the Port number of address.

smsController.GetPort()

public IPEndPoint GetPort()

This function will return the Port number of address.

device.SendSMS()

public bool SendSMS(SMS sms)

This function will send sms to from that device.

device.RequestPassCode()

public void RequestPassCode(string passCode)

This function ask for a passcode from a device.

device.Verify()

public bool Verify(SMSController smsController)

This function will add a device to verified list.

device.Block()

public bool Block(SMSController smsController)

This function will add a device to blocked list.

device.Unblock()

public bool Unblock(SMSController smsController)

This function will remove a device from block list but still not in verified list.

device.IsBlocked()

public bool IsBlocked(SMSController smsController)

This function check if a device is in blocked list.

device.IsVerified()

public bool IsVerified(SMSController smsController)

This function check if a device is in verified list.

device.Disconnect()

public bool Disconnect(SMSController smsController)

This function will disconnect a device.

sms.Send()

public bool Send(Device device)

public bool Send(List devices)

This function is similler to device.SendSMS().