Location widget

Hi guys. I'm trying to make a widget based on the "Location mode, one of: OFF, SENSORS_ONLY, BATTERY_SAVING, HIGH_ACCURACY, UNKNOWN". So i have five jpg location icons (green, yellow, orange, red, question mark), which I want to turn into a widget that shows one of the above mentioned location modes, but since I'm a real noob in the "if" syntax, I wonder if someone can tell me how to write it. Many thanks.

10 replies

Hi Sasha👍😁 my rooting days are well behind🤣😂🤣. I use Klwp now, and for the System an app called Galaxytheme, that you can tweak your system without root. And to be honest, for me, the new OS's had marginal innovations.👍😁👌

True. Little innovation, plenty of aggravation...I updatet the MIUI yesterday to the new Pie version and, I suppose following the numerous "blessings" they got on the forum (me included😂), the Xiaomi team included notifications in the left bar...if you can call notification something that popps there for a second ( blink and you missed it) and then the clock is back😂😂😂. But since the KLWP appears to be very limited by the MIUI and they keep clashing, I suppose I have no options but to join the chorus of malcontents on their forum in the hope of making the Xiaomi team drop the iPhone crap and give us a true Android. And a year from now either hope that either LG gets dual band gnss too or go for the Mi Mix 3...if I ever get my hands on the idiot that invented the notch I'll kill him...

Every brand have its complaints, I have a Samsung s6 , and I"m stuck in Nougat, a very good phone, but a $750 dollars in my country 2 years ago and I don't have more actualizations 🤷‍♂️🤷‍♂️🤣😂

Oh man...I switched from Samsung "flagman" a long time ago exactly because they went Nokia on people and stopped providing support and updates. I went with LGs and was much more satisfied. Only went with xiaomi when they came up with with Mi8. For now it's the only model with a dual band GNSS. And the only one with a price tag of under 400 Euro for a Q845 and 6G Ram. But...I guess the price cut is not like they say, because they keep the profit under 5%, but because they employ amateurs to do the firmware.... As for the S6, go Cyanogen. You get 3 more years at least on updates. I used to do it with my last Samsung, the S3.

At the last what you can make it's erase this widget (it's a Kwgt widget??) and create other and see what happen👍

Maybe the preset from the playstore is a locked one (I don't know how this work, I don't use third party presets😁)

It is. Did it. Four times. Every time the same thing. I can only think that somehow the MIUI clashes with the KWGT. Damn thing, if the Xiaomi wouldn't use third rate software devs from India to cut down on costs and they would make a normal instead of a limp notification bar, and some other garbage...I wouldn't even need to go through al this trouble. Like this it' s like having a Ferrari that runs with a constantly pulled hand brake. The hardware is amazing but their famous MIUI is a regular piece of crap compared to LG or Samsung versions of Android...and I used to complain about Samsung bloating the phone with useless junk....I just checked...the komps are unlocked.

If this kompo works in the past, it's a weird situation, if not you can try to unlock the kompo and see what is the code of the whatsapp number(if this are one of what are failing). I'm testing a similar kompo(I don't know if is the same, I don't have the name of your kompo designer😁)and it's work well with phone calls. My komp is from BB freebies by Bacon Bits.

To unlock the kompo you need to tap in the lock in the top right of the editor.👍

It's exactly Dynamic Status Bar by BaconBits. The one with 5 styles. And I used style 1. And the funny thing is...it did work. Strangely enough, it appears to have stopped working when I switched from KLWP to a simple live wallpaper from google play and just kept the widgets...

Hi Sasha👍 you changed the name of the kompo when you modified it,yes? If not you overwright the original. I don't know in what Kwgt or Klwp version are you, but in the 3.37  version you don't have more notifications from calls and messages, because a new security policy by Android that not allow other apps like Kustom read call and message notifications.

Hi. No, I attempted a raw kompo with no changes at all. Simply placed a 4x1 widget and added Style 1 Dynamic then saved. My KWGT is 3.36 as I see and OS is MIUI And I was careful to release read call and message. They appear at least to he released... And whatsapp isn't even call and message, it's a third party app...

I don't know what are your codes and your mess🤣😂👍, what you can make is create a 1 notification bar only for this and if the notification is from Google play it's show up, if not, no.

😂😂😂good idea. Try it one by one👍

Apparently I didn't do anything...the notifications simply don't work in the widget mode. I used the stock unmodified "Dynamic" notification bar and only the right side works, the one with data, wifi, etc... The left one that should show the notifications, is dead for some reason...

You need to put in the text the ni(tittle) and ni(text) to have this information, if your phone broadcast it to other apps( like Kwgt)👍👌

Yeap...figured i should do something like that, but for now I just seem to have messed up other notifications😂😂😂. The whatsapp notification failed to appear after my fumbling around😂😂😂

Hi Sasha😃👍 For Playstore the package name (pkg) is


And the name of the app (app) is

Google Play Store

To know the name of the package or the app to use in codes you have three options:

1) You have one app in the playstore to know the name of the package of your apps, I don't remember the name 😂🤣👍 , you need to google it.

2) When you have a notification of this app in the ni codes you have in ni,pkg code the name of the package, in this case you can actualize an app that you have and when the notification appear, you go to the ni codes and you have here the name of the package of Play store.

3)The last is in the Play store, you need to go to the app that you need the name in the Playstore, and the last part of the link of the app is the name of the package, like


org.kustom.widget is the name of the package of Kwgt

Good luck👍😁

Thanks. So...I already have the KWGT installed and running. I will run with the com.android.vending to see the result. I would have never guessed the line😂😂😂. I just wanna get the general updates available notification, like the one in the good old Android classic phones (this Mi8 packs one hell of a hardware, but some of their software tweaks simply stink😂😂😂). I don't need it to show me what updates are actually available, just that they are and how many. Beats the hell out of doing it manually every couple of days😂😂😂. Thanks a million, I'll start tinkering👍

Hiya Nelson. You are bang on with understanding what I wanted. And your formula was the first thing I tried. For some reason, that simple formula didn't want to cooperate. Kept returning 0. In the meanwhile, by good old trial and error formula, I came up with a longer one that works like a charm ( for some reason I can't use paste here). Added a tap function to it that takes me to the location toggle and it works like a charm now. Nevertheless, thanks very much for the input. Much appreciated 👍

Hi Sasha😁👍 you are welcome!! Good that you find the good formula to work!!👍👏👌

Hi Sasha👍 To be clear😁👍, what you want is that the icon .jpg appear (show) when the location mode change,yes??

You have 2 or 3 options to make this, I'm going to give you one(I think is the most simple😁)

Put your .jpg in one image items, one image item over the other.

And then put this formula in the Opacity of every image(tap in the square in the right of the word Opacity, tap in the calculator in the top right of the editor, this is going to open the formula editor)

This is the formula for the OFF icon.


Here you are saying: if the lmode is equal to OFF, opacity 100,if not opacity 0.

You need to change the Off to whatever in every icon opacity. Try this and see if work like you want.

Hi again Nelson. You seem like a versed guy in these matters. So I thought maybe you have a solution to a new thing that buggs me. You're familiar with the notification bars, right? So here's a thing. Since I' m using a Xiaomi Mi8 and the guys neglected to put a completely functional notification bar, I started fiddling with one to suit my needs. So I took a komponent one and tweeked it to my needs. Where I ran into a wall is when I tried to replace the notification for incoming gmails with a notification for play store updates. Since I don't use the gmail app, I thought it would be easier to convert that one...problem is...I can't make it to recognize the play store app. I tried "play store", "playstore", "google play"...nothing. Keeps saying invalid path... Any ideas?