I'm working on a lockscreen widget(not trying to be specific here, but Nexus 7 ) . The widget has a button which would trigger an activity.When the user clicks the button, the unlock slide symbol get's highlighted hinting the user has to slide-unlock his screen before he wants to see the button's activity. Since now, the device is locked,is there a way to bypass this and just display the activity on top of the lock screen? (not in the case of pin/pattern obviously, but only just slide)
Was searching a lot for a way to do it. We need to use flags in while giving an intent to the widget button. More information here.
Android Lock Screen Widget
Related
I have developed a Widget for my Android App, and It can be added in following ways.
User can long press in the Home launcher and select Widgets and then drag and drop to Home Launcher Screen, like this -
and then
From the App, in a button click, If
Build.VERSION_CODES.O && appWidgetManager.isRequestPinAppWidgetSupported is true
then we call
appWidgetManager.requestPinAppWidget
And It works, for some devices It doesn't work even if isRequestPinAppWidgetSupported was true.
I am looking for a way to navigate user to 1st way ( going to select widget screen) from my app, whenever isRequestPinAppWidgetSupported was false.
I've used:
addWidgetActivityLauncher.launch(Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply { putExtra(EXTRA_APPWIDGET_ID,requireActivity().appW.allocateAppWidgetId()) })
But this opens up a screen like this
,
but clicking on my widget doesn't do anything. Just closes this dialog.
I want to automate the 1st way till the widget selection screen from my app.
PLease help me discover what I am missing.
I've been trying to lock the navigation bar on Android for 3 weeks so that the user can't send my activity to background. I need to do this to get my lock screen app more secure (I know that writing a custom lock screen is not the best idea but it's a requirement).
I've tried immersive mode, system dialogs, flags on decor view, onKeyDown, onBackPressed (this one works for the back button), reorder_tasks and moving my task to the front (this only works when I click on recent apps) and the usage API.
I've found this app: https://play.google.com/store/apps/details?id=com.wow.keypad.lock.screen which does EXACTLY what I need to do but I don't know how they did it.
Could anyone please help me?
I need a permanent solution like the one these guys from WOW have done.
Thanks!!!
How To Hide Navigation Bar Permanently In Android Activity
It looks like something like this has already been tackled. Your main task would not be to lock the nav bar, as much as just hide it so that the user cannot access it.
is it possible to get touch access of launcher while showing activity?
while activity covering only quarter of screen area only.
as i said make an activity layout which cover quarter area of screen, I added flag for activity getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, PixelFormat.TRANSLUCENT);
it works :) to get access of launcher screen, even my activity is open. I notice another one thing i m not able to get click event on launcher, nor getting focus from my activity to launcher, it's just giving me touch event on launcher.
any one have idea over this, how can i get focus from my activity to launcher or any open application.
Is there a way to find out when did a user click "Setting" options on the screen menu?
The onClick listner's KeyDown events catches only the hardware buttons on the phone and not the clicks of the sofware keyboard that shows up when a textbox/editText gets a focus and the key guard shows up.
Is it even possible using public android SDK.
P.S. : I am only concerned with 2.2 and 2.3 so its fine if this is not possible on 3.0 and above.
Thnx
EDIT
Explanation of a scenario that will help understand the question better!
I have a full screen activity with a editText and a button. I want to intercept all the clicks that a user make and based on that make some decisions.
I am able to register a listner to intercept what phisical keys are being clicked(HOME, MENU, VOLUME UP/DOWN etc)...The problem is, when the user clicks on the editText i.e. the text box gets the focus, the sotware keypad shows up. Now I also want to intercept what keys(numbers, alphabets, special characters or even custom functions on some samsung android phone like 'Go To Settings' are clicked and perform action based on the clicks.
My question is, is it possible and if yes, then how?
NOTE: Please dont ask me why am I doing this because its bad user experience. I am very much aware of that. I am trying to do this in a particular context that needs this functionality. Thnx!
You need to use the KeyListener class and setKeyListener
http://developer.android.com/reference/android/widget/TextView.html
This only allows you to modify/filter input into the TextView.
I have an activity here.
I want to click a button and then hide the activity GUI.
That is, GUI is needed and you can hide it by clicking a "Hide App" button. How can i
implement this "Hide App"?
Somebody help! Thanks in advance!
To do what you want within the organizational model of android, your "program" should be written as a service, not an activity. You would then have a gui that is an activity and a client of your service, which can be started (made visible) and paused/stopped (hidden) as desired.
Presumably when your user clicks the hide application button, you're going to want to show something - at the very least a show button, so the user isn't stuck without input options!
So what you really have then is two views, one with the GUI hidden.
Two approaches I can see:
Hide app calls another activity with only the UI shown that you want. When the activity is finished, use Activity.finish() to return to the original activity with the GUI
Look at ViewAnimator and its subclasses (ViewFlipper and ViewSwitcher)
You could also just enable the screen lock. ;-)
That would automatically lock the screen (hide your app). And when the user unlocked the screen (using the UI and a gesture the user is already very familiar with) he would automatically get back into your app without you needing to do any extra coding.
The additional advantage of the screen lock is that it can be be password-protected, so if the user has his screen-lock already set to a password, instead of a slide bar -- he would just get the slide password thingy.