How to programmatically trigger google home broadcast - google-assistant-sdk

What I'd like to do is write some code like:
var googleHome = new GoogleHomeSdk();
var devices = ['kitchen', 'lounge', 'bedroom'];
googleHome.broadcast({
devices : devices,
message : 'The front door has been open for 30 seconds'
});
Which would then do something similar to the native broadcast feature, i.e. where you type 'broadcast ' into the google assistant app on phones/tablets.
I can't seem to find any google documentation for an API like this but it seems like such a basic/obvious requirement that surely something like this must exist?
Note: I've seen a workaround where people have casted an audio file (obtained via text-to-speech service) but this isn't really what I'm after.

The platform does not provide a mechanism to programmaticlly broadcast messages to different devices.

Related

Where to find tthe documentation to use googlemail commands on mobile device?

I'm looking for the documentation that cover this kind of links :
googlemail:///co?to=email
(An example in this thread : Is there an iOS mail scheme url for Google's Inbox?)
I would like to make a search for specific mail executing a command using gmail app on my mobile device (IOS)
Something like that : googlemail:///search?messageId=foo
But I'm not enabled to find the rigth documentation.
Thx.

How can I best manually reply to texts from a Twilio phone number?

I'm a bit fed up with other phone providers and would like to have a more programmable, configurable, personal phone number (I miss GrandCentral). Google Voice is good, but I want to build something better. Twilio is great! I'm considering porting my personal phone number to Twilio.
I already have phone routing TwiML figured out, but where I'm stuck is text messaging. I can't just forward text messages to my burner phone/smart phone, because for replies to be natural, I need to be able to reply and have it get routed back to the sender. Google Voice handles this by forwarding every incoming forwarded text from a unique number so replies go to the right place, but I think this would get expensive quick with Twilio.
Is there a simple app or gateway that someone somewhere has already built (Twilio themselves perhaps) that lets me reply to texts to a Twilio phone number? It could be a web app, mobile app, WhatsApp gateway, whatever.
I looked into Twilio Programmable SMS/Chat, which definitely seems like the right building blocks, but also seems like to solve this I'd be building a web/mobile app and a backend service to manage my texts. Surely something already exists for manual text response to Twilio numbers.
I looked into Twilio Flex (and other customer management/agent center solutions) and that could work! But it seems overkill and I couldn't find a way to do Twilio Flex agent responses (e.g., reply to my family) on my smart phone. Is there a Twilio Flex mobile app? Is there something less overkill? I thought for sure I'd find something in the Twilio dashboard that would let me manually reply to texts.
Just looking for the most basic SMS/MMS inbox with reply functionality for a Twilio phone number I can find without having to build too much. Thanks!
FrontApp is another paid service that supports a Twilio integration for SMS messaging. There isn’t exactly a huge base of people using Twilio for individual purposes, so I don’t think it’s that surprising that what you’re looking for doesn’t already exist (though I agree it would be cool if it did).
Potentially, you could also look into the Twilio CLI utility as a way to interact with the API without so much developer overhead. Perhaps your new SMS interface is just going to be an SSH client on your phone connected to a box with the Twilio CLI installed?
An easy way to use your number for free (besides Twilio's costs) is to use a Google Spreadsheet with a script attached.
Here is a basic template you could start from and adjust accordingly.
STEP 1. Create New Google Spreadsheet.
STEP 2. Label columns A-E Date, From, Incoming Message, Reply, Status.
STEP 3. Open script editor and clear contents and paste code below.
STEP 4. Edit script by inserting your TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, (can be found in your Twilio dashboard) TWILIO PHONE NUMBER.
STEP 5. Deploy your script as a web app MAKE SURE to set the "who has access to the app" to "anyone, even anonymous" (Twilio will only work with public URLs).
STEP 6. After deployed copy the web app URL supplied by google.
STEP 7. Go to your Twilio phone numbers and paste the URL as the webhook for when a message comes in, MAKE SURE you change it to HTTP GET.
NOTE: make sure to authorize the script, by running the function from script editor.
function doGet(e) {
var body = e.parameter.Body;
var from = e.parameter.From;
var time = new Date();
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
ss.appendRow([time,from,body]);
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Reply')
.addItem('Send Reply', 'sendText').addToUi();
}
function sendText(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = ss.getActiveRange();
var message = range.getValue();
var getNumber = ss.getRange(range.getRow(), 2).getValue();
var number = '+' + getNumber;
var messagesUrl = "https://api.twilio.com/2010-04-01/Accounts/PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE/Messages.json";
var payload = {
"To": number,
"From" : "PASTE_YOUR_TWILIO_PHONE_NUMBER_HERE", //make sure its formated as +15556667777
"Body" : message,
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic " + Utilities.base64Encode("PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE:PASTE_YOUR_TWILIO_AUTH_TOKEN_HERE")
};
UrlFetchApp.fetch(messagesUrl, options);
return ss.getRange(range.getRow(), 5).setValue('Sent');
}
To use it type a reply in the row you want to respond to make sure any cell in that row is selected, then go to the "Reply" tab and click "send text"
Here is a free android app you can download from the google play store. It was created by a Twilio employee, and offers what you were looking for. It does have some limitations which you can read in the description.
https://play.google.com/store/apps/details?id=com.tigerfarmpress.owlsms

How to access Siri voice selected by user in Settings in iOS 11

I am writing an app that includes text-to-speech using AVSpeechSynthesizer. The code for generating the utterance and using the speech synthesizer has been working fine.
let utterance = AVSpeechUtterance(string: text)
utterance.voice = currentVoice
speechSynthesizer.speak(utterance)
Now with iOS 11, I want to match the voice to the one selected by the user in the phone's Settings app, but I do not see any way to get that setting.
I have tried getting the list of installed voices and looking for one that has a quality of .enhanced, but sometimes there is no enhanced voice installed, and even when there is, it may or may not be the voice selected by the user in the Settings app.
static var enhanced: AVSpeechSynthesisVoice? {
for voice in AVSpeechSynthesisVoice.speechVoices() {
if voice.quality == .enhanced {
return voice
}
}
return nil
}
The questions are twofold:
How can I determine which voice has been selected by the user in the Setting app?
Why on some iOS 11 phones that are using the new Siri voice am I not finding an "enhanced" voice installed?
I suppose if there was a method available for selecting the same voice as in the Settings app, it'd be shown on the documentation for class AVSpeechSynthesisVoice under the Finding Voices topic. Jumping to the definition in code of AVSpeechSynthesisVoice, I couldn’t find any different methods to retrieve voices.
Here's my workaround on getting an enhanced voice over for the app I am working on:
Enhanced versions of voices are probably not present in new iOS devices by default in order to save storage. Iterating thru available voices on my brand new iPhone, I only found Default quality voices such as: [AVSpeechSynthesisVoice 0x1c4e11cf0] Language: en-US, Name: Samantha, Quality: Default [com.apple.ttsbundle.Samantha-compact]
I found this article on how to enable additional voice over voices and downloaded the one named “Samantha (Enhanced)” among them. Checking the list of available voices again, I noticed the following addition:
[AVSpeechSynthesisVoice 0x1c4c03060] Language: en-US, Name: Samantha (Enhanced), Quality: Enhanced [com.apple.ttsbundle.Samantha-premium]
As of now I was able to select an enhanced language on Xcode. Given that the AVSpeechSynthesisVoice.currentLanguageCode() method exposes the currently selected language, ran the following code to make a selection of the first enhanced voice I could find. If no enhanced version was available I’d just pick the available default (the code below is for a VoiceOver custom class I am creating to handle all speeches in my app. The piece below updates its voice variable).
var voice: AVSpeechSynthesisVoice!
for availableVoice in AVSpeechSynthesisVoice.speechVoices(){
if ((availableVoice.language == AVSpeechSynthesisVoice.currentLanguageCode()) &&
(availableVoice.quality == AVSpeechSynthesisVoiceQuality.enhanced)){ // If you have found the enhanced version of the currently selected language voice amongst your available voices... Usually there's only one selected.
self.voice = availableVoice
print("\(availableVoice.name) selected as voice for uttering speeches. Quality: \(availableVoice.quality.rawValue)")
}
}
if let selectedVoice = self.voice { // if sucessfully unwrapped, the previous routine was able to identify one of the enhanced voices
print("The following voice identifier has been loaded: ",selectedVoice.identifier)
} else {
self.voice = AVSpeechSynthesisVoice(language: AVSpeechSynthesisVoice.currentLanguageCode()) // load any of the voices that matches the current language selection for the device in case no enhanced voice has been found.
}
I am also hoping Apple will expose a method to directly load the selected language, but I hope this work around can serve you in the meantime. I guess Siri’s enhanced voice is downloaded on the go, so maybe this is the reason it takes so long to answer my voice commands :)
Best regards.
It looks like the new Siri voice in iOS 11 isn't part of the AVSpeechSynthesis API, and isn't available to developers.
In macOS 10.13 High Sierra (which also gets the new voice), there seems to be a new SiriTTS framework that's probably related to this functionality, but it's in PrivateFrameworks so it doesn't have a developer API.
I'll try to provide a more detailed answer. AVSpeechSynthesizer cannot use the Siri voice. Apple has locked this voice to ensure privacy as the malicious app could impersonate Siri and get private information that way.
Apple hasn't changed this for years, but there is ongoing initiative regarding this. We already know that there is a solution to access privacy sensitive features in the iOS using the permissions, and there is no reason why Siri voice couldn't be accessed with user permission. You may vote for this to happen using this petition and with some hope Apple may implement that in the future: https://www.change.org/p/apple-apple-please-allow-3rd-party-apps-to-use-siri-voices-for-improved-accessibility

Xamarin iOS how to get all available SysSound list?

I'm trying create a list of all available alert sounds given in an iOS device.
In Xamarin's website, there's only one example:
https://developer.xamarin.com/recipes/ios/media/sound/syssound-example/
I would like to know which additional sounds can I access via my Apple device.
Edit:
How do I get the list of build-in alert sounds
Found the answer here :
https://www.theiphonewiki.com/wiki//System/Library/Audio/UISounds
e.g:
string NotificationSoundPath = #"/System/Library/Audio/UISounds/sms-received6.caf";
SystemSound notificationSound = SystemSound.FromFile(NotificationSoundPath);
notificationSound.AddSystemSoundCompletion(SystemSound.Vibrate.PlaySystemSound);
notificationSound.PlaySystemSound();

App with custom URL callback and custom search URL

I'm looking for recommendations for an iOS barcode scanner app. Specifically for iPad which will support a custom URL callback to enable the app to be launched from a web browser.
Additionally, it needs to support and a custom search URL which will send the user back to the website once the barcode has been decoded into a URN (SKU).
I have discovered ZBar which is an excellent app, unfortunately it doesn't support custom URL callback and it's designed for the iPhone.
Another app pic2shop PRO seems to tick these boxes, but it's relatively expensive at £10.49 and the setup will require somewhere in the region of 200 installs.
I did a similar project using the free version of pic2shop . The thing is that the free version can read only these types of barcodes : UPC-A, UPC-E, EAN-13, EAN-8 , according to the documentation of the app.
Pic2shop is a free barcode scanner app available for iOS® and Android®. It reads UPC-A, UPC-E, EAN-13, EAN-8 and QR codes. The app also display comparison shopping results for UPC and EAN.
From my personal experience, I can say that it scans and decodes the barcode very fast and very accurate.
In my project the app is launched from a webpage, it works for both android and ios. In order to get it working you have to invoke the pic2shop app from a url and then set your callback address. You will find the decoded barcode data as a value to a parameter in the callback url. To help you more, you can get those values using this javascript function found here.
For example:
<input type=button OnClick="scan();" value="Scan Barcode">
<script>
function scan(){
window.location="pic2shop://scan?callback=http://yourwebsiteurl.com/index.html?barcode=ean"
}
</script>
As soon as the item is successfully scanned it will redirect you to the callback url with the actual barcode number as a value to a parameter. For example http://yourwebsiteurl.com/index.html?barcode=5123548745123. I already told you how to get the value of a url parameter with javascript.
PDF417.mobi Pro barcode scanner app supports that use case.
Note: I'm a developer on that project.
Basically, the app can be launched from any other app, including a web application, when url in the form: pdf417://scan?type=PDF417,UPCA&callback=myscheme://myaction is launched.
The app then scans the barcode, in multiple formats, (PDF417 and UPCA in this example), until the result is obtained.
Then, the app opens the URL myscheme://myaction. In your case, this can be your web service, http://www.somemyscanner.com/service.
Specifically, it will open the URL using format: http://www.somemyscanner.com/service?data=[data]&type=[type].
You can then use those parameters to implement your desired functionalities.
I tried the PDF417 app and it is EXTREMELY expensive (for an app - $28) and does not work. I bought it anyway because I am trying to solve the same issue and I can tell you it is not the solution for general barcode scanning.
It might work with pdf417 barcodes, but those are few and far between and I haven't been able to get it to work. I definately does not support any standard barcode formats. It also has no settings panel (in settings) and the tap target in the app that should be settings just take you to the company web site.
I am still testing other apps but haven't found any app that does what you ask, Red Laser used to but it no longer has that functionality.

Resources