Massive SMS sender with c# and numbers from database - c#

I have office program that I use for my work and there are a lot of partner information into database. One of column is Mobile Phone.
What I want to do is make is to connect my android phone to PC, run that office program and from there send one message to all partners from database.
How can I pass message and number to my android and then send sms?
I have read about sms sending from pc but I found something that works only with nokia phones, some programs, and something that is outdated.
My office program is made in c#/winfroms/firebird.

You have to write an api (Connection to users database and hande sending sms) with mvc and c# then you can write simple app in Android studio to send message to your api(with retrofit2 library). If you want more help. I can write some sudo code here.
If You have to send SMS by cell phone, you can get list of number by an api
MVC Api Controller to get Target Numbers from android:
public class SmsUsersController : ApiController
{
private Context db = new Context();
// GET: api/SmsUsers
public IQueryable<SmsUser> GetSmsUsers()
{
return db.SmsUsers;
}
}
and use retrofit to read api values:
http://square.github.io/retrofit/

Maybe a sms gateway can help you, https://github.com/ushahidi/SMSSync

Related

Is there a way to send Cloud Messages or Push Notifications to a Flutter App from C#?

For my use case, a user from C# WinForm desktop application generates some data (creates a new document in a collection named "Requests" in Firestore). What I want is that whenever a new document is created/added in the Requests collection, a notification is sent to the Flutter app. I am looking for some guidelines for a workaround regarding this using C#.
I assume that you have already connected your C# software with firebase as backend. If that is the case then:
1- First connect your flutter app to firebase.
Follow this link to do so: Connect flutter app to firebase
2- Use this link to learn and create your first cloud function on firebase.
Create first cloud function from flutter app terminal
3- Now you are in the position to create a cloud function with which a notification will be generated to the device you want on the creation of document in the request collection.
4- Deploy this function on your firebase to send notification to your required device.
exports.sendFirstNotification =
functions.firestore.document('/Requests/{documentId}')
.onCreate(async (snap, context) => {
var name = "Bilal Saeed";
var myDeviceToken = snap.data().fcmToken;
// You need this token for push notification on a device.
// Each device has its own token.
// Access it in this function.
//If you are working on C# software then create your token from flutter app
//and save it on firestore. And access that token here and save it in myDeviceToken variable.
// Currently in this function its assumed that, the newly document created //in your Request collection contains the device token which is being //assigned to myDeviceToken variable.
await admin.messaging().send({
token: myDeviceToken,
notification: {
title: `Hi, you received first notification by the help of ${name}`,
body: " Upvote his answer if he really helped you!"
},
}).then(value => {
functions.logger.log("First notification sent to the device");
}).catch((e) =>{
functions.logger.log(e.toString());
});
});
Use this command from terminal to deploy your this function.
firebase deploy --only functions:sendFirstNotification
Now create the document from your C# software and you will get the notification on your flutter app mobile device on the creation of document in Requests Collection. Congrats!

Defining GattCharacteristic as a Server

I want to fill my variable "selectedCharacteristic" with
GattCharacteristic selectedCharacteristic
selectedCharacteristic = Constants.ResultCharacteristicUuid;
Unfortunately, this doesn't work. It won't convert.
The ResultCharacteristicUuid is from the Microsoft UWP BLE Example.
https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/BluetoothLE/cs/Constants.cs
My program, which has not much to do with the microsoft example (besides the constants.cs),
opens up a BLE Service on start, along with the Result-Characteristic. It acts as an BLE server, nothing more.
So when my BLE Server started, there should be a simple solution to get the device infos and everything GattCharacteristic needs, or not?
The goal is to write to the characteristic as the server, not as a client.
What do I need to get the ResultCharacteristic-Uuid into selectedCharacteristic ?
The UUID should be defined by yourself when you are creating your own service, characteristic. Based on the document- Bluetooth GATT server, you could generate your custom UUID from Visual Studio through Tools -> CreateGuid (use option 5 to get it in the "xxxxxxxx-xxxx-...xxxx" format). This uuid can now be used to declare new local services, characteristics or descriptors.

Firebase Realtime REST onDisconnect

We are building a presence system for our Xamarin.Forms app that utilizes Firebase as it's backend.
Early in development we took the decision to use a wrapper library for the Realtime Database REST API (https://github.com/step-up-labs/firebase-database-dotnet) instead of using the native libraries for IOS & Android.
So far it has saved a great deal of time but now we are running into problems implementing a onDisconnect like system.
I have been digging in the Android and JS firebase libraries on github and found that the client libraries send a specific action parameter shown below. They seem to pass the constant "o" to indicate a onDisconnect push.
private static final String REQUEST_ACTION_ONDISCONNECT_PUT = "o";
...
#Override
public void onDisconnectPut(List<String> path, Object data, RequestResultCallback onComplete) {
this.hasOnDisconnects = true;
if (canSendWrites()) {
sendOnDisconnect(REQUEST_ACTION_ONDISCONNECT_PUT, path, data, onComplete);
} else {
onDisconnectRequestQueue.add(
new OutstandingDisconnect(REQUEST_ACTION_ONDISCONNECT_PUT, path, data, onComplete));
}
doIdleCheck();
}
Is there any way you can send this action parameter with the Firebase Realtime Database REST api?
Thank you for your time.
Cheers
The native Firebase Realtime Database SDKs for iOS, Android and Web use a persistent Web Socket to keep an open connection between each client and the server. The server uses this Web Socket to detect when the client disconnects, and when that happens it will execute any onDisconnect handlers that the client may have attached.
The Firebase Realtime Database's REST API is connectionless, as it uses regular HTTP(S) calls for the traffic between the client and server. There is no way to attach onDisconnect handlers through the REST API.

Twilio mms from an Android phone within Canada using Unity3D

Target Platform : Samsung S6 - Android
Development base : Unity3D using C#
Intention :
Send a picture (MMS) shot within an app to any desired phone number within Canada. This app is supposed to be preloaded to a single Samsung S6.
Questions :
I was unable to find any Unity samples within you SDK, however I was wondering if anyone knows Unity samples for my intended use. However planned to use these scripts as first of reference.
Though the Android Phone number which is used to send MMS can be associated with Twilio the receiver would have no association with Twilio as the sender phone number is not something we would know until the photo is taken - hence is this a concern?
I see that from from the API call
// Send a new outgoing MMS by POSTing to the Messages resource */
client.SendMessage(
"YYY-YYY-YYYY", // From number, must be an SMS-enabled Twilio number
person.Key, // To number, if using Sandbox see note above
// message content
string.Format("Hey {0}, Monkey Party at 6PM. Bring Bananas!", person.Value),
// media url of the image
new string[] {"https://demo.twilio.com/owl.png" }
);
the fourth and final parameter is a URL link. Can link of the image be from any server or should it only be from twilio's server?
Thank you very much for time. Highly appreciate it.
Here you are. As far as I know this works like a charm.

LoadAsync doesn't work in windows phone 8 with WCF data service

My friend and I just created a WCF data service and would like to consume it with a Windows Phone 8 client. For the WCF data service part, the OData is proved to work with a windows form project which an do CRUD for the database.
So to get WP8 consume WCF Data Service, we followed the tutorial step by step and downloaded the sample code on the MSDN tutorial
http://msdn.microsoft.com/en-us/library/windows/apps/hh394007(v=vs.105).aspx
However,the examples don't work.There's no display of data from database on the phone.
We find the
Customers.LoadAsync(Query)
under function public void LoadData in MainViewModel Class doesn't load the XML data in :http://services.odata.org/Northwind/Northwind.svc/Customers().
public void LoadData()
        {
            // Instantiate the context and binding collection.
            _context = new NorthwindEntities(_rootUri);
            Customers = new DataServiceCollection<Customer>(_context);
            // Specify an OData query that returns all customers.
            var query = from cust in _context.Customers
                        select cust;
            // Load the customer data.
            Customers.LoadAsync(query);
        }
We modified the function OnCustomerLoaded to display the error message if there's any:
private void OnCustomersLoaded(object sender, LoadCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show(e.Error.Message+e.Error.InnerException);
}
// Make sure that we load all pages of the Customers feed.
if (Staffs.Continuation != null)
{
Staffs.LoadNextPartialSetAsync();
}
//MessageBox.Show(Staffs.ToString());
IsDataLoaded = true;
}
We get the following error:
We are using VS2012 premium, created Windows Phone 8 with data bind project, using OData 5.0.0.
We have to admit that this error may not be the root cause of the problem, but we can't figure it out since we are new to it. We appreciate if anyone can point out what shall we change to make the example work if this is not the error root.
Thanks so much!!
This looks like your app does not have access to the internet, it probably caused by setting issue of your WP Emulator.
You can first try the built-in internet explorer, and check whether it has internet access. If not, you can go to the Hyper-V configuration page, and try change the network adapter settings, or refer to the following page for detail.

Categories