Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm looking for a reliable way to let the Android user show a web site on the lock screen.
This could be done in principle in 3 ways:
Showing it on the native Android lock screen, but then they should be able to remove the native clock because my site is a world clock (you can see it at intelnav.50webs.com/world_time.html if you're interested). For all I know this can't be done.
Using a 3rd party custom lock screen that allows this. Unfortunately I couldn't find a good one, and I did some searching.
Writing a custom lock screen myself.
There are some suggestions and even sample projects for doing this, even some questions here on StackOverflow. But I'm not sure how reliable they are. There is no standard way of doing it, from what I found, since lock screen widgets were removed. But the proposed ways of building custom lock screens don't seem very reliable to me, from what I could judge from the comments I could find. So, one of my questions (sorry but the problem is somewhat complex), does anybody know of a sample project for a custom lock screen that actually has an app built by it and offered on Google Play and which actually works well on a wide range of devices ?
Could anybody help me with a suggestion for a reliable way to do what I want? Along the lines above?
Looks like I'm going to answer my own question. I'm not sure how many will be interested but you can never know.
Update sep 18: Now there is a short answer that wasn't available a year ago when I first answered it. Namely, my own WebLock app:
https://play.google.com/store/apps/details?id=com.simionescu.vlad.weblock
Below is my original answer that gives a general idea of how this can be done programmatically.
So I went into digging and looks like it can be done. It wasn't even as difficult as I feared it would be, though I wouldn't say it was very easy either.
The main points are as follows:
I wrote an app that basically puts the site on the native Android lock screen. (Actually, I already had an app and I added this functionality to it, but that's less important. The main thing is that my method requires writing an app.)
So I guess this falls somewhere between the cases 1 and 3 above. I do need an app, but it's not a full-fledged custom lock screen, as detailed below.
This of course means that the method is more general, it works with any app, not just for displaying a site.
Set FLAG_SHOW_WHEN_LOCKED for the Activity window, as shown for instance here:
How to make our own lock screen in android instead of default lock screen
But I only used this flag, the other 3 mentioned in the link I didn't need.
Launch the Activity (if it's not running already) and set it on top before the device screen goes off, that is on receipt of the ACTION_SCREEN_OFF event. This way, the app is always visible when the screen goes off so next time it starts, Android will put it in front of the lock screen. (At least if it's the standard one; from the documentation it looks like it should be working with a custom lock screen too but I didn't test it. I guess it depends on how that custom lock screen is written. Anyway, I don't necessarily want my site on a custom lock screen, if the user has one he probably won't want to see my site in front of it).
This also means that the site will appear in front if the device is switched off then on, even if it's not locked. Which is what I intended.
Automatically start the app at startup via the BOOT_COMPLETED event
Capture the standard back key (which is allowed, unlike for the home key) and make it act like the home key when it would otherwise terminate the app.
I intentionally let the home key act normally. This of course means that after pressing it (which is the way the user exits the app and enters the device) the lock screen underneath is shown. Otherwise I would have had to deal myself with password-protecting the device, which is in no way something I want to do. There are a few drawbacks with this approach but IMO they're small. For simplicity's sake I chose to do it like this.
Besides, this way my app remains reliable, which it wouldn't have if I had hijacked the home key, no matter which way.
As said, this means that this is no full-fledged custom lock screen, just a way of putting the site over the default lock screen.
(update nov. 18) There's one more important point. As described so far, such an app could have a security issue. I'm not an expert so I'm not sure if it really does, and if so how important it is, but you can never be too safe. If the user can go unchecked to any site, when on the lock screen, it means that if the phone is lost and a bad guy finds it, he could go to a site that has dangerous code that could unlock the device. I'm not sure if it really could be done but I wouldn't be surprised. So, one good advice for anybody who writes such an app would be to severely (but reasonably) restrict Web navigation while on the lock screen.
These are the main points, there are a few other implementation details but I'll leave them out for the moment.
All this looks pretty standard and reliable to me, given that it's all in the official Android documentation.
I tested it on my KitKat device, plus on 2 emulators, one also with KitKat on it, the other one with the latest and greatest. Everything seems to work fine. Including the case when the device / emulator is password protected.
So I just wrote the app and published it on Google play. It's here:
https://play.google.com/store/apps/details?id=com.a50webs.intelnav.worldtime
Which means that now there is at least an app on Google Play which has this feature. It remains to be seen how well it will behave. I'll probably have to make minor corrections in the coming weeks, but other than that it should be fine.
Also in the coming weeks, maybe a month or so, I plan to put another app that will do this generally with any site, at the user's request.
(update nov. 18) I finally wrote the app and put it on Google play. It took a little longer than planned but it's ready. It's 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 restricted to the same domain, so that if a bad guy finds the phone he cannot go to some malware site and unlock it.
Related
First off, this has never happened before on any other android device I've used (multiple devices have been tried and tested before this).
Now I have an app that I have worked on for a little over a year now, it is called AutomatedId (on the app store) and it has worked quite well for my company for quite some time.
Recently I have been given a device to add compatibility to the app (specifically for reading UHF tags) but that isn't the problem.
The problem comes whenever you open the app, the screen stops reading inputs completely, as well as buttons cease to function. I turned on developer options to see the screen inputs and as i suspected, it completely stops and does not read any of the inputs after the app is opened. Clicks don't work, buttons don't work, keyboard doesn't open, hardware buttons on the device stop working. It's a mess, does anyone know what could have caused this?
This is a S98 from here: http://www.wepoy.com/product_view_18.html
moved my comment to the answer as you said. This may be due to memory leak. Here are some references that may help you fix them: Fixing-Memory-Leaks-in-Android-Studio & use this library from square to detect memory leaks early: leakcanary
I do have a problem and have very little to go on. I'm about to release an App (created with Air for Android As3) on the Samsung App Store and just got a list of issues that have to be resolved after the app has been tested by samsung staff before the app could be released.
I did manage to solve almost all of the issues, but 1 very important one is beyond me. They say the screen turns/stays black, when returning after the device alarm interrupted the app. This issue practivally happend on all their devices, including a group including the phones I own (e.g. Galaxy S3).
I do have "OnDeActivate" and "OnActivate" listeners in place that are there to pause the app, disable sound etc. if it loses focus, gets minimized etc., yet I checked on my devices and I can't reproduce this error. Meaning if the app gets interrupted on my device by the alarm, I can resume it without any problems. no black screens.
So the question is: Is there any way for me to fix that at all? I do have to work within AirForAndroid AS3 so I guess possibilities are limited. Any clues where I can look? Any listeners to set, or is there a way to maybe "force" the app to reinitialize or refresh the display? Or to listen for the system alarm? Help would be much appreciated. Thanks in advance!
I am trying to overcome the same issue, I read somewhere that setting the stage quality to something else on both the activate and deactivate events might solve the issue.
So just set your stage quality to medium or whatever different in the deactivate and set it back to what it needs to be in the activate.
This should make AIR snap out of that black screen for the alarm (I hope)
An app of mine is with this fix is currently undergoing testing on the Samsung App Store.
I hope it fixes it.
Good news, the dirty fix of toggling the stage quality seems to have worked for Samsung, it has not shown up in their latest certification report of my app.
by the way, this is not for a stage3D app, that's different
It's for a GPU app
When the app loses focus on Android (goes into background) it will lose the context, which among other things mean that you lose all the created graphics, cached objects and like.
You didn't specify what kind of app it is. If you're using Stage3D, that means you'll have to recreate all your textures, and if you're on plain old displaylist, you'll have to recreate any bitmaps that were created at runtime, and redraw your screen at least once (so the vector graphics get redrawn too).
Now, if you're using Starling, for example, it can take care of recreating context for you (there's a flag for enabling that), although you'll still have to recreate dynamically created bitmaps.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is it possible to configure an Android install to run a single app?
So, basically, I'm currently working on an android application that is intended for use on dedicated tablets inside of classsrooms. While using this app, we don't want the students to back out and go messing around, ignoring what they're supposed to be doing. Is there a way to:
a) Have an app launch on startup, so there's no initial access to the home screen
b) Lock the app so it can't be backed out of, and will be the only thing to run
The only way to achieve what you're looking for is:
Modify Android at the firmware level
Make your app the homescreen replacement.
Option 2 is considerably easier. Basically, you tell Android that your app is the replacement home screen, and then set it as the default on each device. That way, whenever the device is unlocked, your app will be shown, and pressing the home button will only launch your app. This essentially stops the device from opening up any other apps, unless it is done via notifications, which you can take away by making your app full screen. The only possibility left to leave your app now is via recent apps, or a service that launched apps on a device shake or something. You can get around this by making sure that no other app was launched prior to yours, or clearing the recent apps manually. The service can be gotten around by simple not installing any app that does that.
You can look into the default home screen app, which is open source and available at:
https://android.googlesource.com/platform/packages/apps/Launcher2.git
I've done a fair amount of research on this and the options are not pretty:
1) Write your own Android home screen
This one is involved but seems doable. Theoretically you could choose to write a home screen that only includes a link to your app and doesn't allow any other icons.
Try this link
2) Create you own lock screen
This may give you more control over the device, but the only options historically have been to use unpublished APIs that have been now been changed to disallow this.
A little background first. I'm developing an application for corporate devices running on the Android platform. It won't be distributed on the Play store and thus, is unavailable to the general public. The devices are owned by the company and its only purpose is to run this application. So accessing the home screen/notifications/application history/ app drawer are unnecessary and in fact we want to focus the user experience directly on this application.
The current problem I'm facing is preventing access to the notification tray. Simply making the application full screen is not a solution. We do actually need to see the status bar. It's the easiest way to provide network,gps and battery status information to the user.
So far my research has only turned up one solution, which is to go full screen (again, not a solution for this problem,I need the status bar to be visible). I know there's a number of lock screen apps that are able to do this so there must be a way. I just haven't found it yet.
I am not sure, but probably that you can't just lock notification bar from the application level. Android app is isolated from the Operating System and another apps, so it is not able to lock OS features.
Solution that came into my head is to make app fullscreen and create Your own status bar with battery level, current time and network status. It is not hard.
Another solution would be to prepare Your own Android distribution :)
Moreover probably You would like to override all buttons (home, back, search) so user is not able to leave your app.
Very likely is not going to be possible on a Stock device, you'd have to root and potentially install your own version of the OS to allow for this behavior. The system was purposefully made to disallow applications from having this type of behavior. The creators of the OS had the general public in mind as users, and they wanted to prevent applications from being able to "lock" the user out of portions of the device.
Much easier solution like #Jacek states is go full screen and make your own View to display whatever info that you do want from the Notifications bar, AFAIK there are public APIs to access all of that information.
I looked around and although there are many related questions I didn't see one that answers my exact question:
I would like to create an app that runs in the background that provides the exact same functionality as the hard coded 'Back' button in all cases.
The reason? I (for example) have a Droid X, and it is BIG. it makes it extremely hard to use one-handed and having a swipe gesture function as a back button (like in Palm Pre for example) would greatly increase the ease of use.
as far as I'm concerned the app could just be one simple class that contains:
1) a listener for the 'back' swipe
2) a call to the physical hard button itself
Is this possible? are there built in APIs for the hard coded buttons that would allow me to call them without actually pressing them?
Again - I'm not interested in overriding the button, I'm interested in making a software call to it - or failing that, in emulating it's behavior in any and all states and other apps!
Please forgive the naivete of this post. I am a very novice programmer and really I just want to know whether this is possible before I start to devote myself to trying to build it.
Thank you,
b
Is this possible?
By writing your own firmware, yes. Via an Android SDK application, no.