Sending an SMS from mobile via HTML5/JavaScript - javascript

I'm creating a web application for mobile devices that will be downloaded in one of the markets with a mini web server and run on any OS ( iOS , android , Windows8 , etc. ) .
I want an application to be as independent as possible of the OS. I only wanted to use HTML5 and JavaScript .
The application allows a user to make a number of orders just by clicking buttons. Example : [List contacts ]
I need to click [List contacts ] and is sent a text message automatically to other mobile device with an android application that receives the request and sends the response via sms . The response has to be read by my web application . The application can be able to work without network / Wifi .
I've been searching and I only found ways to open the native application for sending sms.
I see that question, but I want to create my own way to send sms without dependencies of other applications.
Is there any way to make this submission automatically?
Or can I use/create some plugin to use on JavaScript to do that?
[EDIT] Can this might be a possibility? Can someone explain me?

I believe the essential information was already mentioned in the comments, but my 2c here anyway.
As already commented, with current modern mobile operating systems apps don't get unlimited access to SMS functionality. From the user point of view allowing this would be potentially quite a hazard, since SMS's usually cost money and user should be in control of such activity, instead of having a random app sending and receiving SMS's freely (without user knowing it). Android is a bit more flexible regarding this kind of functionality, but as mentioned, iOS and also Windows 8/Windows Phone 8 only allows you to integrate to the SMS sending application and for SMS reception, there's no proper way to get access to incoming SMS's.
So, with a native container (such as PhoneGap) you could get one step forward with Android, but for other platforms the possibilities are limited to using the native SMS application. If you need to use SMS for some reason in the backend side, services such as Twilio are probably your best shot, but using SMS locally on the device is pretty much a no-go, unfortunately.

Related

Connect and read data from a bluetooth device with NodeJs?

I have a small hygrometer/thermometer that is bluetooth and comes with a proprietary application that connects to it to read it's data. The device is meant to connect to your smartphone. But I suppose it could connect to my laptop like any other device, but the application it uses is mobile only, so I couldn't do anything with it if I did.
The issue I am really wanting to solve is that obviously I need to be in range of the bluetooth to be able to connect and read data from the device. But I want to be able to monitor it when I am not home. What I was thinking about was keeping a laptop connected to this device, and then running a node server locally that sends the data readings every few minutes to a hosted database, where I then could build a small application that can consume the data sent to the database.
In my limited research, I found this: https://www.npmjs.com/package/node-bluetooth
Which looks like it would help me immensely. And also this post from Google: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web
I am a bit ignorant on how bluetooth works in terms of how something like your phone for example, actually connects to the BT device. Is it reading an address 'broadcasted' out from the BL device? Would I need a MAC address for the device or something along those lines? I guess I am struggling to understand how that even using the aforementioned library, I actually connect to the device. I think I would need some sort of address to even do that. Furthermore, is it possible this device doesn't allow connections from anywhere other than through it's proprietary application? Excuse my ignorance with this again, this is something I just started diving into this afternoon.
It's maybe not so practical, but I want to see if I can do something like this using just Javascript.

peer to peer (p2p) connection between smart tv and smartphone

So, I program for a couple of years now and I only programmed websites. However, I wanted to make a Web App for my LG TV and already downloaded the SDK, ide, emulator, etc.. And it was pretty easy to get a basic App that works fine. I also used PhoneGap (used to make mobile apps with HTML, CSS, js, node js) to do the same App for my android phone.
So my problem is that I need a way to get p2p (peer to peer) connections between my tv and my smartphone. I want to do a simple game, where the tv is used as a monitor and the phone as a controller. However, I don't want to use a web server. You should be able to play it, without an internet connection, but with a wifi network.
I already looked for WebRTC, but I didn't understand how it works, to be honest. I also read something about socket io. From what I have understood is, that the tv needs to run an HTTP-server and then the phone needs to connect to it? But then, the smartphone somehow needs to know the IP of the HTTP-server. Otherwise, you would have to type the IP every time you want to play.
I don't need a finished code, just a point where I can start and an explanation.
Thanks!
Turns out, there is something called ConnectSDK which solves my problem (It works not only with LG TV's but also with 7 different platforms). The SDK is made by LG, however it took me 8 months to find it.
Why? Because LG is not telling you about this SDK on their own page for TV developers... Even though creating a websocket server on the phone and make the TV join this server by manually typing the ip works, however ConnectSDK provides a much better user experience.
It feels like they don't want that people programm good apps for their TV's.
LG communication skills: 1/10
Given the specifics of the project (small lan), to bypass the necessity of inputing an ip adress, i usually do :
1- Retrieve the phone ip address and subnet with phonegap js api;
2- Scan the subnet range for http server with a predefined route to identify the smart tv app(at most 255*255 adress to scan for big lan; with js its easy to parallelise hundreds/thousands of simultaneous requests);
----> this route should output something readable identifying the appliance, in case of multiple results.
3- Display the list of results on the phone; retrieve user input; then connect.
You need to use websockets (hence, why not socketio implementation) to be able to do real time interaction with small delay given the parameters of your project.
Enjoy !

How to allow only 1 vote per person(computer/mobile) on 1 post at website without making user accounts ?

I'm recreating Yik Yak mobile application as a web application in process of learning Meteor framework. But that app is completely anonymous without user accounts, but still you can upvote or downvote post only once. How to make this work ?
What you want will probably require more than just JavaScript, and some back-end code (with the language of your choice).
If it's a website, you can try to identify a user by the IP/MAC address of his/her computer. But the problem is that it is not going to be reliable (e.g.: users could hide behind fake addresses, or multiple users could use the same IP). You can read about some methods on this question (PHP).
If it's a mobile application, use the unique device ID (but again, that will require more than plain JavaScript).
On Android: Settings.Secure#ANDROID_ID (read more on this question)
On iPhone: [UIDevice currentDevice] uniqueIdentifier (read more on this question)
On Windows Phone: DeviceExtendedProperties.GetValue("DeviceUniqueId") (read more on this question)
If you are using Cordova/PhoneGap to create a web app, you can use the device.uuid to get a unique identifier (read more here)
With the unique device ID (UDID), you can identify what device voted, without knowing who is the owner of that device and without forcing your users to create an account/log in.

Offline symfony2 application

Situation
I'm building a little chat using Symfony2. I'm wondering if there are possibilities to make the chat usable in offline mode. I'm not expecting to actively chat with connected user. I'm planning to make the user able to write message in offline mode (in the metro for instance), and then send it when connection is back again. Important: I would like to compute in the fact that connection can be gone for a long time. I remember beeing with people working in the Eurostar (Paris - London) and using their computers/phone while in a submarine tunnel for an hour or so. There was no connection at all. So in this case, how can you store a message for such a long time before sending it?
Problem
I found some interesting tutorial defining the HTML 5 offline mode. They define the capabilities of this offline mode with sending message but doesn't give example. Moreover, it seems that the only stuff we can put in the manifest are static files (css, javascript, html, pictures...)
My question is then, how do you store the written message from the user after she/he pressed the "send" button and is offline? Is it a javascript variable? Or is there html 5 features that exist?
Cheers!
You can do this via HTML5 local storage:
http://www.redrobotzoo.com/posts/html5-local-storage-and-local-databases-tutorial/
This example has very nice examples so it should not be a problem for you to make it work.

See and talk to your currently online users on your site in a Ruby on Rails 3 application

I have a Ruby on Rails 3 application, and I want to be able to see a list of who is currently online. For example user1, IP address, and country. I then want to be able to open a chat / push messages to this user until they leave my site.
How can I accurately monitor who is currently on the site and instantly remove the user from the list when they leave?
I then can talk to them via faye pub/sub.
How can I accurately monitor who is currently on the site and instantly remove from list when they leave?
Well using HTTP you can not do this "instantly" in a browser. Almost all solutions I see use a heartbeat technique. Every X seconds, a request is sent from the browser (using Ajax), that tells if the user is online. If you haven't heard from the user in x heartbeats, you regard the user as disconnected - even Facebook uses this, it seems. I will recommend you to drop your requirement for instant, unless it's really important.
Another approach is to implement Flash or Silverlight, to make a socket connection to the server. But the demand on the server is high, and if many people is on your site, you will run into trouble with ports and so on.
I think this is not so much related with Ruby on Rails... but this is very hard to implement in HTTP with a scripting language only. The server does not know whether a user has closed the browser or not. The server just sends the requested page data to the user and closes the connection.
You would rather have to integrate Ajax or Flash to make things easier. I have seen some people developing chat programs with Flash, and it seems to work much better than any other Ajax-implemented chat programs.
Chat is very unfavorable in a web browsing context, since the page will be reloaded as the user clicks a link. If you are thinking about building an application that only supports a chat feature, you probably want to look something other than Ruby on Rails. For example, Node.js will be a good one.

Categories

Resources