Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Friday, July 16, 2021

Setting up a Broadlink SP4L-UK Smart Plug

 SP4L-UK is a smart switch that can be controlled by hand phone via WIFI. It is compatible to Google Home. This model is suitable for Singapore home because it uses the same 3 pin plug configuration commonly used in Singapore. 

Now before you could do anything, make sure that your home wifi is set at 2.4G because this device is not a 5G compatible device. Most home network have both 2.4G and 5G wifi connection. You handphone will auto switch between two wifi connection automatically anyway. Only problem is that you need to specifically connect to your 5G network manually. While setting up, you must turn on bluetooth and use a 2.4G network on your phone.

Download BroadLink-Universal TV Remote app. Android users need to make sure no screen overlay app is running when setting up the app. You cannot turn on/off screen overlay if one is already running.

After setting up user login, follow the following steps.

  1. Plug the smart switch into the power socket. You will notice the LED on the switch blinks continuously.
  2. Click add device. 
  3. Choose "Wi-Fi Devices" 
  4. Select "Other Wi-Fi Devices". 
  5. Choose "Smart Setup" and click "Next". 
  6. Click "Done" ignoring all the information on the screen. 
  7. It will prompt you to enter your wifi login information. The SSID will be automatically chosen. Just enter password accordingly.
  8. After a while your device will be set up properly. The LED on the switch should go off.
  9. Set up the Name and room information for the device and you will be done.
In the even of error the LED blinking rate will go much slower. You need to reset it by pressing and hold the button near the IR sensor at the end furthest from the three pin socket. Wait till it blinks at a faster rate. It will be ready for you to try again. 

You may wonder why I choose a smart plug that is using only 2.4G wifi. Actually, there is not much choise. Furthermore, the range of the wifi is wider than a 5G wifi. Most manufacturer choose to use 2.4G wifi over 5G wifi. 

You can use your 5G connection to control the devices as they are all on the same router connection.







Thursday, July 15, 2021

Android Screen Overlay Switching Greyed Out

Screen Overlay is one facility on Android to have some app hovering over all apps so that user can quickly access the app anytime.

One thing Google never tell you is that once an app is run with Screen Overlay, You cannot turn on Screen Overlay mode. To turn on or off you need to go to to Settings then click on the wheel on top left of the screen then choose "Draw over other apps" after that slide on "Permit drawing over other apps". The selection is greyed out.

The only way to enable the "Permit drawing over other apps" setting is to completely close the app that does Screen Overlay then make the changes before enabling the Screen Overlay app again.





Monday, November 09, 2020

Getting the distance from a QR code with known dimension

 In working towards an app that guide VI to navigate indoors (Blind Navigation System Using QR Code), I am working out the distance of a QR code from the navigator. This will allow the app to works like iBeacon that could tell the distance of navigator from the device.

OpenCV already have methods that could measure object dimension from a known reference. The first step is to convert the known dimension to pixel ratio. This will allow for different camera with different megapixel count. The formula is simple. ratio=pixle/real size of object.

With this constant, I will need to determine the distance from the navigator to the QR code. First I find the QR code then measure the QR Code size. The QR code most likely have to be enclosed within a rectangle so as to allow the measurement of the rectangle. Convert this size (in pixles) by the formula size=pixle*ratio. Viola, we get the distance from the QR code.

Measuring the position of the QR code is an essential metric. This will allow navigator to know the direction towards the QR code. This is easily done by getting the center point of the camera view then get the relative position of the QR code to the center point. We can inform the user whether it is to the right or left. Calculating the distance from the center point is quite meaningless as it is not useful to the navigator.

Unless navigator has a perfect memory of the position of all the QR code, there is a need for a map of the location with precise point of all the QR codes. The app should also allow the plotting of routes from one QR code to another so as to provide a voice guided navigation for the VI.

Deviating from the QR code will be an issue. Unlike iBeacon, once the QR code is not in the camera view, VI is practically lost. A facility to turn VI back to the track has to be made by approximating the last known point.




Thursday, November 01, 2018

Setting up Google Play on Mi5X

I always have problem with Google Play using Mi5X. It is not available when shipped. Installed Google Play Apk from websites and it can launch Google Play.

One of it works just fine but the other one will prompt "Server Busy" on and off. Following netizen advice to totally remove Google Services and Google Play store. The result is that I cannot restore Google Play at all despite installing Google Services and Google Play apk from sites that provide the apk. Even my account information does not list the Mi5X as a device.

While looking for ways to restore back Google Play by searching for "Google" in Mi Store, I notice Mi Store has a prompt saying something like it is not able to list Google products due to limitation. Thus whatever advice on the web does not apply.

Searching for "MiUi Google Play" turn out something like a installer for Google Play. Tried to go to Mi Store again and look for "谷歌安装器”。 It still turn out nothing.

This calls for drastic measures. I notice there is a "去豌豆荚搜索“ in Mi Store when searching for "Google". Tried that and it  actually shows one app called "谷歌安装器”. It is not by Google but look rather like a "Google Play Installer".

Followed instruction to allow for "unknown sources" in Settings.Additional Settings,Privacy. The apk was installed successfully. Running it and it prompts for installation of a number of Google Apps. Upon completion, Google Play can start without issue.

The next thing to do is just wait and see if "server busy" prompt will show again.



Friday, April 01, 2016

Is Android screen locking App useful?

Tried an application on my android that have a lock screen widget floating on the screen. It can work as purposed. I do face a few difficulties.
It usually failed right after I lock it and then unlock although the widget still appears after the message. It is quite annoying to see the message popping out. It seems to be intermittently disappearing also. Moreover it interferes with my keyboard widget. My keyboard keep goes intermittently missing while I am typing.
Finally give up and unset the floating lock screen icon and used shortcut icon instead. It worked only on the home screen but I usually close all app before doing manual screen lock so it still works fine for me.
Some might ask why I want to use an app to lock screen. Well, On off button is a mechanical device. It will fail if used too often. So rather than clicking it twice every time I want to use the phone, the app will remove one click. That is half the number of clicks. 

Most screen lock app works about the same way. I tried two and it has same issues.


grin emoticon

Saturday, July 26, 2014

How I keep WikiLoc alive in my Android

Recently, I got a Huawei Honor 3C for free (with redeemed vouchers). This phone has aggressive power saving features. Problem is that it seems to be functioning poorly when I don't want to save power. I need to turn on a certain app even when screen lock is turn on. It simply refused accept my settings.

There is a system app called "Protected Application". This seemingly is one application that keeps other application alive when screen lock is on. However, only certain program of mine like OSMAnd can stay alive with the setting. Both WikiLoc and Endomondo did not.

At first I though it is some of the App Management program of mine like "Advanced Task Killer" that automatically kills at a regular interval. Setting the two app in the ignore list does not help. Uninstalling the "Advanced Task Killer" also does not help either.

The next thing I tried is to set the "Protected Application" mode to "Normal" instead of "Efficient". It does not work.

The only other choice is to root the Android. Luckily, there is already a root program written specifically for the 3C. Took quite some time to get it rooted. Tried to use AppFreezer, but cannot find the power program to freeze.

Ultimately, tried to make WikiLoc as a system program. Installed two programs that could make an app a system app and vice versal. Uninstalled one and left "System App Converter" running. Started WikiLoc and then lock the screen. Half an hour later, it is still running. Decided to leave it running over night. The next day it was still running.

While writing this blog, tried to find the "Protected Application" icon, it was not there. I did not specifically uninstall it thus it must be one of the "Make system app" that removed it or Huawei remotely removed it.

In the end, I have absolutely no idea how I did it. Anyhow, as long as WikiLoc is running fine, it is ok for me.

Post notes. Looking at the list of freezed applications in AppFreezer, I realized that there is an app called Phone Manager. It was a useless app as there is already similar function in Settings so I freezed it. It turned out that the app also contains the power management program that I was trying to disable. By freezing the app, the power management program is also freezed. I did it without realizing. Now I will try to make WikiLoc a normal progam and see if it is killed again.

It looks like I have to keep it as system app. Removing Phone Manager does not help.


Saturday, June 22, 2013

Camera focus on Android Phones

Auto-focus is a very nice feature. It reliefs people from having to do focusing. However, it cannot solve all problems. For example, if you subject is near and at the side, the background is at  a distance, you are sure to get your subject blurred.

Problem with phone cameras is that there is no hardware control on the focus. One way to avoid out of focus is to set focus to infinity. There are phone cameras that comes with a spot focus. This feature allows you to touch the screen at the spot where you want to focus. This may work a bit. However, if you need to aim for a longer period of time, the focus automatically goes back to center focus. The chance of you getting a blurred picture is still there.

One way out of the situation is to use manual focus. First you focus on the subject using spot focus. You then move the camera to the correct angle and get the picture correctly.

The only problem with manual focus is that you have to focus for each picture. Also, if your phone camera comes with face detection, it will not work in manual focus mode.

There is a big issue if you use manual focus on small and close objects like small flowers growing on branches. Chances of you getting out of focus is very high even on manual focus. I have found a simple solution to it. First put your hand parallel to the object and focus on your hand instead of the object. You can then take the picture of the object (must be in manual focus mode).

It will be too bad if your object is a living thing which responds when your hand moves close to it. You can still estimate the distance between your camera and the object then turn to the side and put your hand at the same distance then focus. It may not be very accurate but the depth of field usually can covers the focusing quite well.



Friday, May 17, 2013

Out of Memory

For those with newer phones, the "phone memory" is at least 1GB. For those who still uses FROYO like me, the available memory is a meager 150MB. With around 20 apps installed, I always receive "out of memory" message.

I was scratching my head on how could I remove unnecessary apps. There are a few OEM installed apps which I can never remove. Thus as time goes, I end up with less than 15MB of memory. It is still usable till you run an update on large apps like Google Maps. It never fails to abort during installation.

Recent encounter during uninstalling of OEM installed programs gives me a surprise. By removing just the updates, my memory can jump 4 folds. I now have 60MB free simply because I removed updates for Facebook, Maps, Voice Search and YouTube. These were apps that I don't use on my Android.

Now I turn off auto updates. What is the use of updating those apps that I would not use and end up with "out of memory"? It sure is a bit troublesome to run updates but it beats the headache to clear enough memory just to update useless apps.



Wednesday, January 23, 2013

Sharing files between phones


Previously I could easily transfer files between two Nokia phones easily. When I switched to Android, I have a problem. There is no such facility.

Now, Android have a few hundred thousand apps. Could any of them be used for this purpose?

First I tried Bump. The gimmick is to knock the two phones at the same time to get a respond to connect. My HTC responded to bumps easily but my 2  LG could not respond till I set the sensitivity to 100%. Once both get a respond, you could then do a connection and select a file to transfer.

Well, I somehow managed to connect and transfer the file to some one else. Weird. Besides this, the transfer worked quite well without a hitch.

It is then that I found out the fact that both must be connected to the same network. That is a flop. If I am outside with a friend on a different Telco, there is no common networks around. Thus this app was limited in its use.

Next, I tried Bluetooth FIle Transfer. Like Nokia, I need to setup connection first. The trouble is that Bluetooth in Android automatically switched off from being "discovered" after 120sec. Although this is good for security, it is quite a hassle when I am playing with two phones alone. After a few tries I managed to pair two phones.

On one phone, I start the app. Then I choose a file. From the menu I choose "send via blue tooth". The other phone automatically responds with a notification to allow connection, then it prompts me to accept the file. It worked just fine. I did not install the same app on the other phone. It is the bluetooth service that responds.

Now, that is weird. How is it that Android can receive files via blue tooth and has no facility to send one without having to install any app? Well, it really hurts to know that the BT is actually meant for phone to PC connection. All the action is done at the PC. Therefore, transfer from phone to phone is actually not required as considered by Android.

Next, I tried to use a normal file manager to tranfer files. Again, file managers are not standard app. The app  I choose is Astro. I choose the file by touch and hold method. Choose "send" then "via Bluetooth". The bluetooth setting appears. I choose the paired device and it sends ok.

Then I discover that there is a module of Astro called "Astro Bluetooth". I installed it and repeats the procedure. Now I have two choices. "Send by Bluetooth" and "send by Astro Bluetooth". Tried both. They are very similar. The only difference is that Astro is more like Bluetooth File Transfer app. I can now send and receive files using Astro. I think I can go without "receiving files". Therefore, Astro Bluetooth is not really needed.

I also evaluated "wifi transfer". Like Bump, you need to be on the same network. Which is no good.

I tried "sonicshare". This one is quite unique. You can do one-to-many transfer. Actually it is using a very old technique. It transmits/receives the data via sound. I can't hear anything when the transfer is going on. Probably using the ultrasonic range.  It worked qute well except that this version has a file size limit. There are two other version from the same company. One thing I don't like is it also send "system generated" files (ads from the company).

There is yet a new file sharing app. It works via wifi. It's called  "Wifi File Transfer". This means you have to have a network connection. The sharer runs the app and it will indicate an IP and a port. On the receiving end, you just need to start a browser and you will be able to download what ever file you like on the sharer. I have not tried uploading but it sure is convenient.


GPX in relation to auto-pause


GPX is a XML formatted data to record the GPS locations that was logged by an application. It could contain data other than GPS information plus date and time. For example it could contain Heart Rate data.

I would not want to puzzle readers with the XML format. It is something which I myself don't want to dwell into. Let's just take it as a format that records data in a particular way so as to allow for data manipulation.

Now, sports trackers stores the logged data in their own ways. It might not even store the data in the XML format. However, most will allow the data to be exported as GPX (a text file that has .gpx as extension). My interest here is to analyse what it does in relation to auto-pause.

A typical data log is as below (note this is not the actual XML as FB cannot display the original code  properly)

[trkpt lat="1.2921916666666666" lon="103.78459"]
      [ele]76[/ele]
      [time]2012-08-29T14:54:43.72[/time]
[/trkpt]

The first line stores the lon and lat information as attributes.

The next line stores the "elevation" as data. The date and time is stored as data in the next line. Both lines become the data of the first line.

The last line indicates the end of the data for the first line. The whole thing consists of one set of data or in lay man's term " a record".

Initially, I was mistaken that the datetime information is the real datetime. The sports tracker simply ignores certain data that falls below certain speed limit. I was totally wrong.

The sports tracker reads the GPS data at regular intervals. It will record the location and the date time information at regular intervals. The auto-pause was done between two readings. If the speed falls below the speed limit setting. It simply ignores the entry. Thus, you get a datetime that is not real time. If you move at a speed below the speed limit then the location will not be recorded. The location and time will simply freeze till you move beyond the speed limit.

Thus, instead of recording datetime, it actually records the time only. Datetime format is used simply because certain sports take more than one day to complete. It also removes the trouble to distinguish between real time recording (no auto-pause) and the auto-pause feature.

Now I am in a dilemma. Originally, I though I could use the logged data as evidence in case of accidents. With the auto-pause, I cannot use it as evidence as it is not real time. But if I turn off the auto-pause, every stop (e.g at traffic light junction) adds extra time to the sports I do thus reducing the speed record. I just can't have the best of both world.

Luckily, the two sports-tracker I use allows me to adjust the overall distance and time so as to calculate the overall speed. With this, I could do a real time logging then adjust the overall time taken to get the desired speed. This means that I need another data logger that has auto-pause feature turned on. Well, it is still better than having a pseudo real time data logging right?

Since I subscribe to two sports tracker site. I might as well use two device to track real and pseudo time record and adjust the overall time and distance on the real time recording so as to get the correct reading for the real time logger. But then I would be labeled as paranoid sports person. Ah... You win some, you lose some. It all depends on how you look at it.



Monday, December 31, 2012

Tracking others on your phone

When you go out to meet your friends at a unfamiliar place, you would like to find out exactly where is your friend. When you go out with your friend on a trip, you may find yourself separated from your friend and wish to find out exactly where is your friend. You may be a parent trying to find out where is your child. Instead of calling the other person/child, wouldn't it be good to just send a SMS and get the location of the other person?

There were just this kind of app that could do just this. All you need is just a map and the other person install the app with the understanding that they could be tracked by you. Alternatively, you can use an app to send SMS of your location to your friend or parent. However, that is not interactive. You need to actively send the SMS or set a constant schedule to send it. Thus, the on-demand-automatic-reply way is still the best.

One example of such app is "Wheres my Droid" by Alienman Tech. This app can also be used as a Android finder.

The app have the ability to intercept SMS to your Messaging. When your friend/parent send a code word, it can read the SMS and respond by automatic reply with a GPS location location. The recipient can then use a map app to display the location. This is best used when the tracked does not have a data plan or is in a place without mobile data.

The tracked person can actually set who can get the automatic respond. A list of phone numbers can be set so that only the keyword from this list of phones can get the reply.

Obviously, parents might want to lock the program with a passkey so that the child is not able to change the settings. I usually suggest to get the child's consent instead of enforcing it against their wish. This feature is also good when your phone is in stranger's possession (lost).

The app has other features that could prove useful. However, that is beyond the scope of this post.



Thursday, December 27, 2012

Android Memory

As time goes along, we tends to load a lot of apps in our Android. At times, you will suddenly gets message "out of memory". Even with the addition of 16GB of sd card, it still keep popping up the same message. What is the problem?

Actually, there are four types of memory that is available in Android.

1. Phone Ram. This is the place where all your apps run.
2. Phone Rom. This is the default place where your apps are stored.
3. SD Card Ram. This is the additional memory where apps are stored and some times use for running.
4. SIM card memory. This is generally used for phone number storage.

Rams are essentially the place where your program is run. Unfortunately, unlike PC and Laptop, this area of memory is not user expandable. Older phones generally have much smaller Phone Ram. This will prevent some apps from running.

Even with plenty of Ram, you will still find "out of memory" message appearing when you try to install apps. This is largely due to the fact that all programs has to be stored in Phone Rom. Despite the fact that in Android 2.2 (Froyo) onward, many apps can be stored in SD Card. However, it still uses some Phone Rom to register its presence. That is to say, every program uses some memory in Phone Rom. New phones has now greatly increased this memory. While older phones generally have much less. The number of app that could be installed is thus limited by this memory. Again this memory is not user expandable.

SD Card memory are generally used to store photos. Many apps uses SD card to store their app data. It is good to install as much memory as possible. Even when the hand phone dies, your data will not be lost. Obviously if your SD Card is damaged, everything goes with it. It is always good to save the data in SD card to computer.

SIM card are generally not use for Apps. It is the place to store phone numbers. However, most phone also stores the phone numbers in Phone Rom. It ends up that you may get 2 same number appearing in phone list. Always try to store phone numbers in SIM card. Should you change the hand phone, your phone number will not be lost. Generally, newly added numbers usually get stored in Phone Rom.

SIM card memory does not have the facility to store other phone number related information than the Phone Rom. You should weight your preference as to what you want to do with the number. If you are the type that stores much more information than just phone numbers, then you should store it in Phone Ram. You should always keep a copy of your client information in PC so that you could transfer the information to new phones.



Monday, December 03, 2012

Voice Navigation on OsmAnd

For a direction idiot like me, having a navigation aid is a must in order not to get lost even in my own country.  I have evaluated quite a number of navigation app in Android and have selected OsmAnd for this purpose. It is free and its voice navigation guide is quite acceptable.

The very first thing you need to do is to get a map. Obviously, if you have data plan, it should not be a problem at all. However, I would recommend a offline map as you may end up in places without data connection. The bad side of offline maps is that you would not be able to get the latest traffic condition. If you are rushing for time, offline maps will not be suitable. If you are planning a trip that you know and the traffic condition is no a concern, this is one application that is suitable.

OsmAnd allows you to download maps for offline use. It obtains map from OpenStreeMap. Just go to Settings, Offline data (download) and download the country in which you will be travelling.

In settings, click on "Navigation". Choose the mode of travel. You may have to repeat the setting if you need to travel by more than one mode. Under "Navigation service", make sure you choose "OsmAnd (offline)". Under "Voice Guidance", choose "en-tts". If you do not see a tts available, then click "install more" and follow the instruction to download tts.

Go back to maps view. You just need to scroll the map to the destination point and then point and hold on the spot till the map shows a location popup. You can click on the "x" mark to close it if you choose wrongly. Click on the popup itself will popup another menu. There are a number of choices. If you are simply going to a single place then click "Direction to here". The route will be plotted for you and a voice will tell you how far is the distance.

When you start to go along the planned route, it will tell you how far before you need to make the next turn. At the point of turning, it will again tell you to make the turn. On experience, the instruction to make the turn may come too late. It is good to listen to the anticipated turn and watch out for the turn rather than wait for the actual turn instruction.

If you are going to multiple places in a fixed order or you are actually planning a route of travel (for example a cycling route), you should plot the route in a route planner like mapometer.com. Export the route into OsmAnd in a directory called "tracks" (create one if it hasn't exist). On OsmAnd, press "menu" then "Directions". Choose the mode of travel then click "GPX route". You can then choose the route you downloaded. Click on "Pass along entire track". Click "Reverse GPX direction" if you are returning from the destination. Proceed to the starting point and the voice guidance will start.

If you missed a turn, the navigation system will re-plot a route for you. If you are using the plotted route, it will plan a new route to the nearest point to your predefined route.

One nice thing is that if you happened to stop and start again on the route, it will repeat the instruction to the next turn. It will also warn you if the GPS is lost.

I do experience silence during navigation. You may need to activate the map screen and click "menu", "Where am I?" to get back to the navigation. Wait till the gps fix is done and it will continue the navigation.