Is("platform") for uwp

Is there a platform string I can use to determine if my app is running in uwp? I assume “core” is meant for desktop and “windows” is used for DEVICES running windows 10 mobile.
I tried “windows” on windows 10 machine and its not working.

I opened an issue here https://github.com/driftyco/ionic/issues/11207 and they closed it without really answering my question.

I simply want to know if i am running in uwp mode (either windows 10 or windows 10 mobile)

I fear your question wasn’t well understood.

What does “is running in uwp” actually mean? What is the opposite?
What do you mean by “devices”? Isn’t my laptop a device?

In basic terms I would like to know when my app is running in windows platform (either windows 10 or windows 10 mobile, not really caring for anything lower such as 8.1, 8) regardless of the “device” its running on. I am doing all this to determine when to make button available on my app to show direction as the commands for launching the map software on windows platform (either windows 10 or windows 10 mobile) is different than ios and android commands.

step 1: determine when exactly to show this new button with the new command
step 2: determine the correct command for launching the map software with directions set (i posted another question about this, still havent figured out the answer or got the answer yet)

Yeah, but that’s not what you asked. Could you please answer my questions?

what i meant by running in uwp is if the app is a uwp app and running on windows platform (10/10mobile).

Laptop is considered a device to me, I have not run the app on a laptop to determine if .is(“windows”) will be true running my app on a laptop, i do know this is false running it on a desktop.

My ultimate question is, how can i show a button only if its running on windows 10/windows 10 mobile regardless of the physical machine/device.

What other kind of app could it be instead of “uwp” if it is running on Windows?

Ok, then I don’t understand your sentence in the Github issue:

only seems to return true if its running on a DEVICE as stated in the platform doc, and will return false if its running on windows 10 uwp app.
How is “on a device” the opposite of “uwp app”?

This is exactly the role of the platform service in Ionic. It should be “windows” no matter if laptop, desktop, phone, whatever - if it runs on Windows, with Windows styles applied.

Initially i was under the impression that .is(“windows”) should be for all windows, then since that didnt work on my local desktp machine but it did on my “device” i assumed my local machine was not considered a “device”.
This is why i posted the question/issue.
What your saying is

<span *ngIf="platform.is('windows')">should should show on all windows</span>

Should work on anything running windows 10(laptop, phone, desktop)

however, that shows on my phone but NOT on my desktop and I believe this is the real issue is that .is(“windows”) is not behaving as it should.

Ok. Mayb output the platforms array in Platform to see what is actually set on the device you are testing on.

Array of platform.platforms()

windows 10 machine:
cordova
core

windows 10 phone device:
cordova
mobile
windows

According to docs, for “desktops” (not really sure if this is just for windows desktops or linux as well), they have “core”

There is nothing in their array that states its “windows” regardless of device/machine and that is what I need some way to definitively determine if the app is running in windows

Yep, that looks like a bug to me.

You should create a new issue for that, describing how you built the app (maybe even build a super simple app that outputs this array to a white page and put it on Github that the Ionic folks can download to recreate your build).

created an issue https://github.com/driftyco/ionic/issues/11226

posting it here for anyone referencing this in the future

2 Likes