Wear OS Tiles: How would one update UI dynamically - kotlin

So I am working to build media tile, but whenever I play the a next song and use getUpdater(applicationContext).requestUpdate(MyTileService::class.java)
it take few seconds before it refreshes the tile, so the next song starts but, the content of the tile do not change. I tries passing the new song title in the tile refresh code, but the tile refreshes before the variable refresh.
when(request.state!!.lastClickableId) {
"play" -> pauseLayout(songTitle_txt!!,request.deviceParameters!!)
"pause" -> playLayout(songTitle_txt!!,request.deviceParameters!!)
else ->pauseLayout(songTitle_txt!!,request.deviceParameters!!)
}
I am also trying to figure how to update the ARC using the song progress, I can archived it the actual Wear OS app, but confused when it comes to tiles. Can one get a reference to the tile elements and only update those ?

I think onclick actions might be different, but if an external event (play time, song name after it changes) is the trigger you will be limited in how often you can update.
See https://stackoverflow.com/a/70565444/1542667

Related

Does Mapbox has a get user pan/swipe event? Can't find anything in Docs

What I'm looking for?
I want to get notified when the user swipes/pans the pan to check other locations.
The only only event I could find is onPress but it is only fired when the user actually presses on the map, but if the user swipes the map to change view it doesn't get fired.
What I need it for
I want to know if the user swiped the map and the user's location is not the center of the map anymore. If yes, then show a button to center map around the user's location. Like I said, how do I know if the user swiped.
What am I using
Mapbox SDK for react-native (currently only testing on ios but I need it to work on ios and android in the future).
What I have tried so far
onRegionWillChange = { ( ) => this.myfunction() }
myfunction here only gets notified when the region loaded changes, not when the user is not centered anymore.
this._map.getCenter()
I user this to know if thee center of the map is the user's location. But I am looking again for the event that gets fired when the user swipes & then I would call this function to verify the swipe.
Any Help is very much apprechiated
I've no experience using the SDK for react-native, but using the JS version you can use on drag events. It might lead you to a way to do it using the react-native SDK.
There are three types.
drag
dragend
dragstart
This shows an example that listen for the drag event and writes out the current center of the map to console.
this._map.on("drag", (x) => {
console.log(this._map.getCenter());
});

need to implement some route behavior, but don't know how

I'm completelly newbie on react and react-native. So i ask to forgive me for possibly stupid question.
I use redux with react-native-router-flux.
First of all, let me describe the behavior what I want.
I have a scene that shows some info about video. The data is fetching from http page. The video have links to another videos - something like "related videos".
On the related video link clicked I need to open new similar scene but vith info of this new video. This vide have relateds too and so on.
So that's what I trying.
A have one scene with key=film. It renders all the info about video. The info fetchs from remote server. On fething it uses this.props.key to identificate the video page. On related video click I called Action.film({key: NEW_VIDEO_KEY}) and new scene opens, takes new data from fetch and shows new video info. And so on. I do this 5 times for example. So 6 scenes was opened (with the first one). But after pressing the BACK button all previous scenes shows the same info as the last one.
I think, it's because of react-router-flux does not remember scenes data but only the route. Each opened scene was modified props, so after the last scene it hase the last props.
I don't understand how to implement needed behavior as I describe at the beginning.
May be I need to add something like history object to the state and after each opened scene push video object to it and on pop scene pop the last video object from the history object... And return the previous object to the previous scene with Action.pop({video: VIDEO_OBJECT})...
But if I showing the related videos in listview I need to save the scroll position of each scene (( And what about hardware back button...
May be I understand something wrong and there is a more complex and simple way...
Ok. I found a problem. the problem was in my misunderstanding how all things works together. Now it works well as needed.

Is there a way to determine whether a Windows Store app is suspended?

I'm building a Windows Store app and it pops up toast notifications from time to time. I also have an animation that plays to show when something has updated. Both of these happen at the same time.
What I would like is to not show the toast when the app is running.
So, is there a nice easy way to determine this or do I have to manually track the state via the suspending/resuming events?
Edited info:
The solution has a background task project which goes off, gets the data, then decides if anything has changed that the user needs to know about.
If so, it creates a toast, updates the tile badge, and plays an animation to fade in the new data.
The issue is that I don't want to show the toast and update the tile badge if the user has the app full screen. Similarly, playing the animation isn't needed until the app is resumed (that's the easy part though).
I realize I could solve it by having one timer that works when the app is running, and a separate background task for when it's suspended but that seems like overkill in this case.
The simple answer here is that if your app is suspended, your code won't be running.
If you want to pop up toasts when your app is suspended, you'll either need to use the WPNS or a background task to track changes.

iOS: Update UI while in Running in Location Services Background

I have a simple app that uses location services, and registers to run in the background. I update a simple tableView with location data. This data is still being received when the user leaves the app and does something else.
Currently I am calling a method in my - (void)applicationWillEnterForeground:(UIApplication *)application to update the UI, but there is still a split second when the app opens, and the UI gets updated.
I have also tried to do periodic UI updates when in the background, but not surprisingly this doesn't seem to work.
Are there any solutions out there so that I can have the UI fully updated when the user brings the app back into the foreground?
The best solution would probably be to profile and see why you have any delay at all before displaying new data. It's quite possible you could do some things to get ready for the display to arrive, like doing Core Data queries ahead of time (they can take a significant amount of time).
An alternative would be to dump a blank UI bitmap from the screen as you were being suspended, and write to it directly based on activity - then when the application resumes, briefly show that bitmap as a screen overlay before showing the real complete UI.

Save Button Pushes and Location

I am making an app where I need to know
every button that was ever pushed by the user in the app, and when it was pushed, and
where the iPhone has gone (using gps), but there are no cell towers in the area so I can't use that significant location changes method everyone uses.
It seems to me like the Plist method for data saving won't work because I don't want the app to start where it left off, I want it to start at the beginning every time.
Also, if any of you have any idea how I can make my app wake up at certain specific times, and/or how I can make it impossible to exit, that would be awesome. This is for an experiment with the University of Queensland St. Lucio Psych Department and the Grute Eylandt Aborigines.
You can know everything the user does in your app if you want. You could use your own solution with an SQLite database for example, and dispatch the data to a server every once in a while.
The GPS is also easy, you could just track the user with the Core Location framework.
You can't make the app wake at specific times, the best you can do is implement push notifications but it's up to the user to open the app via the notification or by themselves by tapping the app icon on the iPhone home screen.
Otherwise you could set up a local notification just before exiting the application, this is faster and easier to implement then setting up push notifications.
There is also no way to stop the app being closed, that is until iOS 6 comes along with it's accessibility features, you can disable the home button then. But not now.