Is there a programmatic way of determining whether a program is running as a widget or app?
Is there a "has" that will do it?
Is there a programmatic way of determining whether a program is running as a widget or app?
Is there a "has" that will do it?
Yes, you can change the project name at any time.
If the app and widget do the same thing, it isn't confusing (except to understand that the two are configured independently).
There aren't different files between the two.
I'd have to fake the difference. Which is what I was referring to with the exclusions.
There's one little thing that takes too long for a widget.
Ok, he's something else to look at consider... Check totalMemory in the app as I think that's different between widgets and apps on CIQ2 devices and newer.
I don't think that would work (not reasonably).
The app would need to know what the total memory for the widget is (and vice versa). You'd need a table of the memory differences between all the devices (something that doesn't exist and something that would need to be maintained).
The simplest thing would be to just have something different in the build process and key off that. Not every file is the same between the two builds as manifest.xml must be different for the app type and ID at a minimal.
Yes, those are different.
Changing the build process (using the exclusions) is a way but it's not "simple".
It is probably the simplest and best way. What you are trying to do is a rather unique requirement..
in one jungle,
base.excludeAnnotations=widget
and in the other
base.excludeAnnotations=dapp
and then
(:widget)
function appType() {
//it's a widget
return true;
}
(:dapp)
function appType() {
//it's a dev app
return false;
}
Yes, I knew that was possible.
It might be the only way but it's not exactly simple.
Actually, I see it as pretty simple, as in your code you just call appType() to see if it's a widget or device app.
You could do much the same with a string resource that differs between the two, and check that for the type.
What you want would be fairly uncommon, as the majority of apps either know what type they are or don't care. I have widgets I'll switch to a device app and back based on what it is I want to test.
It's not as simple as a property of system would be (the thing I was looking for).
The system likely already knows whether it's a widget or an app.
It might have wider application than you think.
It's never come up before in my 5 years with CIQ.. And it's fairly easy to know with just a few lines of code if needed. Far easier than knowing what device an app is running on!