Disable switching from app to homescreen android wear - wear-os

I am running a android wear fullscreen app and after a certain time, the watch switches from app screen to the home screen (shows time). Is there any way to shop the switching. Thanks.

I assume by switches from app screen to home screen you mean that the watch goes to sleep / dims the screen.
Well you can prevent this by adding the android:keepScreenOn attribute to your layout-file.
For example:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
...
</FrameLayout>
Alternatively you can add the flag in your Java-Code as well:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Note: Per default every wear-app will be closed as soon as the screen gets dimmed. A few weaks ago there has been a post on StackOverflow discussing the topic "Long Running Apps on Android Wear". You can find it here along with a pretty neat solution.

Related

Full screen screenshot in ios simulator on macosx

I am programming in mac OSX using VSCode and XCode. I am using a iPhone 14 pro MAX to emulate my app on a device. I have some screens that they dont fit in the screen so the user have to scroll to see the whole screen. Now, I want to take a printscreen of this screen but not just the part of the screen that the user can see, but the whole screen, so when I see the print screen I am able to see the whole screen. Is this possible?

Xamarin Forms buttons stop receiving mouse clicks after clicking on SkiaSharp CanvasView on iOS

I use SkiaSharp canvas to draw the main game screen, and then there are various Xamarin.Forms Buttons around the UI. This all works fine on when used directly on iPhone or iPad using a finger. However, when I connect a mouse (e.g., through a MacBook or otherwise), the buttons start working with about 10% chance after mouse-clicking on the SkiaSharp canvas (and not receiving the mouse click events with 90% chance). The SkiaSharp canvas itself works just fine.
If I bring up the iOS app launch menu from the bottom (which probably somehow temporarily exists the mouse navigation on the app), the buttons start working again with the mouse. But if I click the SkiaSharp canvas again with the mouse, the buttons have a high chance of becoming disabled again. If I change to using a finger, all works fine (even if the mouse clicks were not being registered immediately before). However, mouse clicks are not being registered even after touching with a finger, so finger-touching does not reset the issue with the mouse (but bringing up the menu from the bottom does).
We found this bug by testing the iOS game on MacBook Pro (the iOS apps recently came available on the App Store) but the same issue persists also directly with an iPad / mouse combination. It seems to be some sort of an issue between using a mouse (on iPad or on MacBook Pro), SkiaSharp canvas and Xamarin.Forms buttons.
Does anyone know what the root cause of the problem is and what is the workaround?
Not an answer as such, but some more information about reproducing the issue: A simpler repro case may be this small project: https://github.com/jrc14/TraceMatching/ .
Don't worry too much about what it's doing, but note that you're mean to click in the grey Skia canvas in the middle to create 'targets' - and that after you've done that, mouse-clicks are getting lost.
If you run it on a Mac, you'll see that, though the clicks get lost after you've clicked on the Skia canvas, they will start being received again if you click on something else (another app, or the Mac background).
(further edit) - after some noodling around I did find a workaround. If, once you've finished processing the touch action on the SKCanvasView, you reset its EnableTouchEvents property (i.e. set it to false, then back to true again), it seems that the clicks don't get lost any more,

Xamarin Android MvvmCross Onboarding

so I'm developing an app that uses MvxSplashScreenActivity for its splash screen and it works well. I just got a feature request for onboarding screens to be shown to first time users. Here comes the problem, I can't seem to find a place to hook in code like if new user then do onboarding else show the splash screen. Is this possible or am I not thinking about it correctly. I will be using this AppIntro for the onboarding slides. Any assistance will be appreciated
I like to funnel users through another activity that has the same layout as the splash screen, which allows you to do any other initialisation and decide where the user should go. This means that you show every user the splash screen and every user the 'loading' screen, but where they go next depends on whether they are a new user or not. The user won't be able to tell the difference between the splash screen and your loading screen unless you want them too so it appears seamless. So it will look like:
Splash -> Main Loading Screen -> if new user Onboarding else the first screen of your app
If you are making any calls to an API or doing anything else that could take a while here it is wise to show an activity indicator also, so the user knows something is happening and the app isn't frozen.
I implemented Jason's suggestion. Basically, always show the splash screen and based on whether it's a new user or not show the onboarding screen or home screen.

How to disable the android wear back swipe?

I am creating a Android Wear app that has an touch area. The user is suppose to be able to move it's finger in all directions over the screen (Think touchpad on your laptop). However the back swipe makes this a bit problematic. Any help with getting around this issue would be a great help.
How to disable the android wear back swipe?
/Jakob
There is an attribute in window style to disable this behavior:
<style name="AppTheme" parent="#android:style/Theme.DeviceDefault.Light">
<item name="android:windowSwipeToDismiss">false</item>
</style>
Once you disable it you have to provide other way of exiting your app.
There is a DismissOverlayView class (listed here https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary) that you should use instead.
Basically it provides an overlay that will show a red button with cross after a long press. Clicking the red button will exit your app.
Here is a video from Google I/O 2014 with some bookmarked moments:
https://www.youtube.com/watch?v=sha_w3_5c2c#t=1390 <- disabling android:windowSwipeToDismiss
https://www.youtube.com/watch?v=sha_w3_5c2c#t=1505 <- Java code for DismissOverlayView
You can also check another video called:
Fullscreen apps for Android Wear:
https://www.youtube.com/watch?v=naf_WbtFAlY
You can try to write AndroidManifest.xml theme
android:theme="#style/Theme.Wearable.Modal inside activity tag
<activity
android:name="com.smart.remote.wear.MainActivity"
android:label="#string/app_name"
android:theme="#style/Theme.Wearable.Modal">
If you want the whole app to override Swipe, place the theme property under your Manifest's <application> tag. If you want it to apply only to a certain activity, then place the property under that activity's <activity> tag.
So:
create or update styles.xml in the res/values folder with the android:windowSwipeToDismiss property, such as:
...
false
If you want to override swipe in the whole app, Update your Manifest as such:
<application
...
android:theme="#style/AppTheme">
If you want to override swipe in a specific activity, Update your Manifest as such:
<activity
...
android:theme="#style/AppTheme">
</activity>
where ... represents all your other settings you already have. Remember you will need to give alternative ways out of the activity and/or app depending on which level you overrode

IOS Music Control in Background

I am trying to find the solution to have the control of play/pause when my app is playing the own music in Background. I am using AVAudioPlayer and didnĀ“t find the way to implement this controls. When the app is "close" the music play perfectly but I have to open the app again to pause or change music when needed.
Any solution ?
If you're running iOS 4 you can try putting the app in the background whilst playing music, and then pressing the home button twice for the 'multitasking' bar.
Swipe the bar to the right, which shows you the normal playback controls for Music, YouTube, etc.
If you use the AVAudioPlayer I'm quite sure you can use those same controls to control your app's playback of media.
Bryan
*EDIT does using the remote on the iPhone headphones work?

Resources