Show website on Android lock screen

I am looking for a reliable way to show an Android website to a user on a lock screen. This can be done in principle in three ways:

  • By showing this on their own Android lock screen, but then they should be able to delete their own clocks because my site is a world clock (you can see it at intelnav.50webs.com/world_time.html if you are interested). As far as I know, this is not possible.
  • Using a special third-party lock screen that allows this. Unfortunately, I could not find the good, and I did a few searches.
  • Writing your own lock screen.
    There are several suggestions and even sample projects for this, even some questions here at StackOverflow. But I'm not sure how reliable they are. There is no standard way to do this from what I found, since the screen lock widgets have been removed. But the proposed methods for creating custom locks do not seem to me very reliable, from what I could judge by the comments that I could find. So, one of my questions (sorry, but the problem is somewhat complicated), does anyone know an example project for a custom lock screen that has an application created by him and offered on Google Play that works really well on a wide range of devices?

Can someone help me with a suggestion on a reliable way to do what I want? Along the lines above?

0
android website lockscreen
Apr 27 '17 at 1:41 on
source share
1 answer

Looks like I'm going to answer my question. I'm not sure how much it will be interesting, but you will never know. So I started digging around and looked as if it could be done. It was not as difficult as I was afraid, but I would not say that it is also very easy. The main points are as follows:

  • I wrote an application that basically puts the site on its own Android lock screen. (Actually, I already had the application, and I added this functionality to it, but this is less important. The main thing is that my method requires writing the application.)
    Therefore, I assume that this is somewhere between cases 1 and 3 above. I need an application, but this is not a full-fledged custom lock screen, as described below.
    This, of course, means that the method is more general, it works with any application, and not just for displaying the site.

  • Set FLAG_SHOW_WHEN_LOCKED for the Activity window, as shown here:
    stack overflow
    But I used only this flag, the other 3 mentioned in the link I did not need.

  • Start the Activity (if it is not already running) and set it on top before the device screen goes blank, that is, when the ACTION_SCREEN_OFF event is received. Thus, the application is always displayed when the screen goes blank, so the next time it starts, Android will place it in front of the lock screen. (At least if it's standard, from the documentation it looks like it should work with a custom lock screen too, but I haven't tested it. I think it depends on how this custom lock screen is written. "I definitely want my site was on a special lock screen, if the user has one, he probably will not want to see my site in front of him).
    It also means that the site will be displayed in front if the device is turned off and on, even if it is not blocked. This is what I intended.

  • Automatically launch the application at startup through the BOOT_COMPLETED event

  • Grab the standard rear key (which is allowed, unlike the home key), and make it act like the home key when it otherwise terminates the application.
    I intentionally let the home key work fine. This, of course, means that after clicking on it (as the user exits the application and enters the device), the lock screen is displayed at the bottom. Otherwise, I would have to deal with the password protection of the device, which I do not want to do. There are several drawbacks to this approach, but IMO they are small. For simplicity, I decided to do it like this. In addition, in this way my application remains reliable, which would not have happened if I had captured the home key, no matter which way.
    As already mentioned, this means that this is not a full-fledged custom lock screen, but just a way to put the site on top of the default lock screen.

  • (update nov. 18) There is another important point. As described so far, such an application may have a security problem. I am not an expert, so I’m not sure that this is true, and if so, how important it is, but you can never be too safe. If the user can disconnect on any site, then on the lock screen this means that if the phone is lost and a bad guy finds it, he can go to the site with a dangerous code that can unlock the device. I’m not sure if this can really be done, but I won’t be surprised. Thus, one good tip for anyone writing such an application is to strictly (but reasonably) restrict web navigation while on the lock screen.

These are the main points, there are several other implementation details, but I will leave them for now.

All this looks pretty standard and reliable for me, given that all this is in the official documentation on Android. I tested it on my KitKat device, as well as on two emulators, as well as with KitKat, and the other with the last and largest. Everything seems to be working fine. Including the case when the device / emulator is password protected.

So, I just wrote an application and published it on Google Play. Here:

https://play.google.com/store/apps/details?id=com.a50webs.intelnav.worldtime

This means that there is now a Google Play application that has this feature. It is not yet clear how well he will behave. I will probably have to make minor adjustments in the coming weeks, but apart from that, everything should be fine.

Also in the coming weeks, maybe a month or so, I plan to add another application that will do this in general with any site at the request of the user.

(November 18th update). Finally, I wrote an application and put it in a Google game. It took a little longer than planned, but it was ready. Here:

https://play.google.com/store/apps/details?id=com.simionescu.vlad.weblock&hl=en

As noted above, when on the lock screen, navigation is limited to the same domain, so if a bad guy finds a phone, he cannot go to any malicious site and unlock it.

+1
Jul 03 '17 at 8:35
source share



All Articles