How to start a timer with the Actions on Google Timer trait? - actions-on-google

I'm currently trying to develop a device that will work with the Google assistant. I've followed the Google codelab to set up firebase with the dummy project.
Now I'd like to implement the Timer trait. I'm currently able to set a timer by voice command on my virtual device using action.devices.commands.StartTimer but it only seems to set the desired timer duration in the database and doesn't not actually start it because when I ask "how many minutes are left on the timer" , it answers with the time initially set.
Do I need to pass the information to the device itself, that will handle the countdown and update firebase in real-time so when I do a QUERY , I get the timerRemainingSec from the device through the database ?
Thanks !

Yes. The action.devices.commands.TimerStart command is one of the Smart Home commands that is available if you're building a device. Google itself doesn't do anything with this except pass the command to you.
You are responsible for implementing the command on your device however makes the most sense for your device.
Google just provides a way for users to access your device.

Related

Incoming call notification

We are developing an app with angular/ionic in which we use capacitor jitsi plugin for video calls. What we are now trying to do is to receive notifications (via firebase) like in whatsapp with the incoming call screen and two buttons to accept and decline. Any idea on how to do that?
Thanks
If you got the choice to change the notification service, instead or directly using firebase, you could use Onesignal which extends firebase and they already have a service named VOIP notifications which should kinda do your needs and here is the link:
https://documentation.onesignal.com/docs/voip-notifications
In case your are restricted with firebase or need to know how this could be done, bellow will be the way to achieve it..
As for android:
First as logic part, you need to add some code in the native layer since hybrid apps usually can't interact from JavaScript side to native side in case app was not launched, so in order to wake the application on a specific event like notification received or any other actions that phone system can hold..
Second, as technical part, you need to add broadcast receivers and the receivers role stand to interact as native code with system. example in the link below:
https://www.digitalocean.com/community/tutorials/android-broadcastreceiver-example-tutorial
also another video about foreground and background broadcast receiver service in the link below:
https://www.youtube.com/watch?v=rlzfcqDlovg
video code output in git:
https://github.com/borntocoderepos/callrecorder
in the Youtube video example, the user is launching a toast message on phone call if app was opened or closed (background or foreground) so you can launch your app with intent with passing data and capture the data on app start as Deep Links as capacitor (https://capacitorjs.com/docs/guides/deep-links) or Cordova (https://ionicframework.com/docs/native/deeplinks)..
And instead of listening to network or phone calls, you can listen to Notifications and for sure you need to do searches about your topic and or the notification service that you'll choose.
Now for the video and the tutorial not sure of the quality of code so make sure to do more researches about the way its done from different places (could be outdated code or bad code quality or even not complete service and will discuss about this point below).
In android there is policy about using background and foreground services so once you start a service you need to end it after your done so make sure after you receive the notification and launch your app to stop the listening since it would cost power usage and perhaps could be stopped by Playstore as harmful app.
Now considering IOS it should be the same concept so make searches about this topic, but for IOS, the listeners policy as I remember , the receivers should not be waked up for more than 15 mins, so also keep this in mind and make sure you stop the receivers directly after launching your Hybrid app.
Broadcast equivalent receiver for IOS:
http://www.andrewcbancroft.com/2014/10/08/fundamentals-of-nsnotificationcenter-in-swift/

Have Google Home trigger smart device

I'm developing a smart device that needs to respond to a trigger and take an action. I'm having some trouble however determining what will host the code that fires the trigger. Google Home appears to have events based on time but I can't seem to find anything that can trigger an event based on something like the weather. IFTTT seems like a natural fit but to have customers install IFTTT and then find my applet is a bit cumbersome. I could have my server monitor the condition and fire the trigger but ideally the trigger could be generated on-prem.
So my question... Does anyone have a good suggestion for where to host code that fires a trigger that is sent to a smart device?
*first-time poster so forgive me for any lack of formalities
Automations on Google Home are available for triggering actions but might cover all the use cases you specified. You can create your own system that changes the states of the devices based on your conditions, then report to Google via Report State.

Using Isolates in Flutter

I am trying to understand how I can create a background process in a Flutter Application. Basically, My understanding is that once a user has started the application, the Isolate can be created. This will allow my code to run on the background.
In the background, I want to get a list of Bluetooth enabled devices and their RSSI values within a certain radius, every 30 seconds or so.
I am aware that there are some Bluetooth libraries available for Flutter, but Time is really limited and It would be best to seek advice from experienced flutter developers.
Specifically, I would like to know the following -
Is using Isolates the best way to go about doing this? From my research, I understand that the user has to start the Isolate through some UI Activity?
Could the Isolate(Background Service) repeat every periodically to perform certain tasks?
I need to be able to write the data received from the Bluetooth scan to a database. I understand that the Isolate will not be the best place for this? Based on this blog post by Ben Konyi, it is not good practice to do such tasks within an Isolate.

Setting a Recurring Event using Appcelerator Titanium

I've got an app I'm building using Appcelerator Titanium that will be a combination alarm clock/url fetcher. The part I'm having problem with is that I need to be able to set a time for the app to go fetch the url and then perform actions as necessary (in this case alert the user if data that should be entered in a time system has been entered). I also want it to do this every day (or every week day) at the prescribed time, and I want it to not have to be 'launched' every time. I'd rather it come up and run as a service, or at least run as a service when sent to the background. I'm most focused on the iPhone, but I've got a few Android users that would like it as well.
Is it even possible to have an Appcelerator app hooked into the system like that? If so, are there any tutorials or examples? I can't even find an alarm clock example, which scares me a bit.
I think that localNotifications should work for you.
there is a sample in the bg.js file included in the kitchenSink.
It is also helpful to know that all of the keys/properties available to you are documented here in the source code.
This guy has a nice alarm module written for android.
https://github.com/benbahrenburg/benCoding.AlarmManager

iPhone background network connection by timer

I need to write an application, that every 10 minutes it should be awaken from suspended mode, get user location via gps and send this information to the server by network.
Depending on the response it should return to the suspended mode or show local notification to the user.
Is there a way to do this on iOS 4?
I've tried different approaches, but the only working for me was to start monitoring user location in backgroind and declare the application as location background application. In that case it worked in background and has a network connection. But this approach takes a lot of power and not accepted cause application should work 24/7.
May be there is a way to write some daemon that should work in background and wake my application every 10 minutes?
Apparently, Pastebot tried to do something similar with the 'audio' multitasking declaration (by playing a silent audiofile) and got rejected.. UNTIL they actually presented a option to the user to pick which audiofile they wanted to play. It's in the appstore now. :)
In this case: What is your reason for not wanting to use the location updates? If battery-usage is a concern, you can use the 'significant location changes only' option, after which you can temporarily change to a more accurate option.
This isn't possible outside of the method you have already tried.
The iPhone background task API will allow you to run a location service in the background.
There is no way to write daemons for the iPhone without jailbreaking, and that is not something I'm able/prepared to help you with.
App store friendly: use new APIs in iOS4, which allows u to make use of GPS location
Anti App store: create a daemon by adding a specific plist file to System/Library/LaunchDaemons/ and put ur app under Applications/. this approach requires a jailbroken iPhone however...
detailed information plz google the following keywords: daemon, multitask, background, etc...
cheers, Lloyd