Apple Watch: Input number by Digital Crown like Alarm app - watchkit

How to increase/decrease number by Digital Crown like Alarm app?
https://www.apple.com/watch/timekeeping/

As of WatchOS 2, it is now possible to access the Digital Crown for certain kinds of input.
To do so, create a WKInterfacePicker. The items presented for the user to select between can be text, images, or a combination of both.
To use the WKInteracePicker, add it your interface in your WatchKit App and add an outlet to your interface controller in your WatchKit Extension. Then, for the interface controller call myPicker.focus().
See the Apple documentation for fuller information.

At the moment, third-party developers have no access to the digital crown.

In SwiftUI, you could use aPicker or Slider to input numbers. If you want to do something custom with the crown, look at the digitalCrownRotation modifier which you can hook up to a #State or #Binding and use in other parts of your UI or send to your model.

Related

How to use the "Scan QR code" quick tile to my app's advantage?

In Android 13, we have a new quick tile "Scan QR code". When we scan a QR with it, it takes us to the relevant app or if there are multiple apps that supports this QR data type it lets us choose and navigates to that app.
For example, if we scan an UPI QR code, it shows us all the apps that support scanning UPI code like GPay, PayTM, PhonePe, etc.
Likewise I have a set of QR formats which is used only by my app. How do I tell this quick tile to pick up my app when scanning this QR?

Is it possible to change contents dynamically which Alexa skill shows without any user actions?

I want to create a Photo Frame Skill for Echo Show.
I want to change photos triggered by external server (such as Firebase and so on).
Is it possible to change it dynamically without any user actions?
I saw Notification API and Proactive Events API.
But, These show notifications to user. I don't want to show anythings to user.
I want just trigger controlled from external server to change contents.
The answer depends a lot on the type of skill (for example if it is based on Alexa Conversations or not). But you can try exploring something along this line:
Keep the token of last rendered APL document
Send an APL ExecuteCommand directive from your skill server (https://developer.amazon.com/en-US/docs/alexa/alexa-presentation-language/apl-interface.html#executecommands-directive)
You can use one of the standard APL commands, depending upon your use case. One option is SetValue command (https://developer.amazon.com/en-US/docs/alexa/alexa-presentation-language/apl-standard-commands.html#setvalue-command) to modify the background image.
I want to create a Photo Frame Skill for Echo Show
Technically, a skill can last for a maximum of 5min30sec without any user interaction. Only if you provide a prompt that last for 4min then a reprompt that last for 90sec. It could be a blank audio. But Alexa is not suited for custom skills that stays live for a long time without user interactions.

Android notification channel maximum count

I am new to implement Android notification channel in Oreo. What is the maximum number of notification channels for a single application. Can we create unlimited channels or it has some count?
As far as I know there is no limit on the number of channels an app can create. The only purpose of NotificationChannel is to give more control of notification behavior to the user. It is no way to reduce the number of notification per app.
You can read about Notification Channel in detail at Create and Display Notification on Android Oreo | With Example
There is a limit that is not documented on the number of channels you can have at the same time, but no limit on how many times you can create a channel, as long as you have deleted other channels.
The file PreferencesHelper.java contains a limit that is currently set to 50.000
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/services/core/java/com/android/server/notification/PreferencesHelper.java
And this is being used to restrict the creation of more channels when it goes over that limit, throwing the exception "Limit exceed; cannot create more channels"
Unfortunately that value is not publicly accessible, so any limit check you might want to implement will have to be hardcoded by yourself. My suggestion is to set your own limit to a number that you think starts being unreasonable, and when that is reached you run a check on your notification channels to figure out what is going on, and fix it. For example, if your app will never need more than 5 channels to be created, then setting the limit to 6 would be a good way to start.
The commit https://github.com/aosp-mirror/platform_frameworks_base/commit/f528b337dd48b7e8071269e07e610bd4a3668c75 update the max notification channel to 5.000
Coming with Android Oreo, Notification Channels are something a developer uses to break down the notifications his or her app can give to us by type. The channels are decided by the people doing the developing, and the idea is to give us a way to separate out the notifications that are important to us from the ones that aren't, then decide how they will be shown. Some apps will have a lot of different channels. Some will have just a few and some will have only one.
In versions of Android before O, a developer used what was called a priority level to decide how to show you a notification. If they felt the notification was important, they could set it to peek (show a visual indication on your screen) or make a sound, or both. If they felt it wasn't it would just be placed in the tray for you to see the next time you went through them.
Now they break things out into channels and we get to decide how each type of notification is displayed. All notifications of the same type (for example, a reply on your Twitter feed) are placed into the same channel without any other types of notification grouped with them.
As a bonus, apps that allow us to use more than one account can have channels for each combined — your personal email and work email can follow the same rules and show you things the same way no matter which accounts received the notification.
You should read this:
https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels
Example:

How to define custom slot type for Device Name in Alexa Skill

I am building a skill for special controls of our devices. These controls are not available in Smart Home API. I need to set a custom slot type know as the DeviceName for my intent schema. But a DeviceName has really really a lot of possibilities. I can name a device cat light, Bobby's car, hamburger and etc... And I can't just write them all under the list of samples, it's just impractical.
It isn't clear what you are asking. It sounds like you are trying to build an Alexa Smart Home skill, as opposed to a "custom skill".
Smart Home skills do not allow you to specify your own slots, intents, utterances, etc. You must use the smart home commands defined by Amazon.
If that doesn't work for you, then you'll need to create a custom skill. Then you can define intents, slots, etc.
Amazon's Recommendations for Custom Slot Type Values state that your list of custom values do not need to contain all the values your skill expects. Amazon does recommend that you provide a representative set of custom values with representative word counts.
For example...
Let's say I have the following intent:
- Intent: MyFavoriteBand
- Utterance: "My favorite band is {Band_Name}"
- Custom Slot Type: Band_Name
- Custom Slot Values for Band_Name
* Ramones
* The Pixies
* The Grateful Dead
And the user says, "My favorite band is The Cars."
Your MyFavoriteBand intent would fire and the value of Band_Name would be "The Cars" even though that value wasn't included in the training set.

invoke Apple Watch maps app for turn by turn directions

I'm working on a watch app that will amongst other things need to get a person from point A to point B.
one option is to delegate the maps navigation work back to the iPhone and handle messaging updates between the watch and phone etc.
however does anyone know if its possible to simply invoke/launch the Apple Maps app (on the watch) directly from my own watch app and pass the start/end coordinate details -- to automatically initiate turn by turn directions (from the Apple Maps watch app) ?
The second option sounds legit. According to WKInterfaceMap class reference, tapping on the map will directly open the Apple Watch Maps application.
Quoting from the documentation:
A WKInterfaceMap object displays a noninteractive map for the location you specify. Maps must be configured dynamically from your interface controller. Use the methods of the WKInterfaceMap class to specify the visible region of the map and to add any annotations or points of interest. Tapping the map launches the Maps app on the user’s Apple Watch and displays the corresponding location.
Reference: https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceMap_class/index.html

Resources