how to get android system bottom keys back? - android

I'm developing an android app that blocks incoming phone calls while running.
but after a block sequence android's main keys(Back,Home,..) just changes to a dotted circle !
can any one please tell me what is this
and help me to get main buttons back?
by the way - i'm testing on : Sony C2305(Android 4.2.2)

This is what happens when your android phone is ringing(in default). since you changed default functionality of androids caller mechanism so its what really happen:
1- your phone rings and default caller turns on and hides android system keys in order to display caller screen
2- your application launches too and rejects call using code(and not androids caller application)
3- so as call rejected so androids default application closed with no response(without getting KEYs back!)
Thats it.
so i guess you should work with main caller istead of your own code to solve this problem.
Hope help you

Related

Flutter app stay running while in background

I have an app I have building that is giving navigation from a location to a location. Contstantly tracking where the user is using GPS data in order to give good Directional information. Currently if a user switches from our app to another app or goes to the Android home screen, after one minute Android turns off our app for performance reasons.
I have tried using an Isolate but like flutter this gets shutdown. Next step were to use a kotlin service to handle background things but i wanted to check if anyone had done this in dart yet?
Also this is not an app that will be in the play store or on public devices. It is going on special devices that we control and are less worried about memory usage as this will be the main app ran on them.
as mentioned above in the comment by #galloper background_fetch is the thing you need, it has a method called BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask); where backgroundFetchHeadlessTask is a function that will keep running even when the app is close, i used this in my app to stream location info to server.

Can we automate "Call Receiving" feature in android?

I'm trying to automate calling features in android using robot framework + appiumLibrary.
What I've done so far?
I am able to dial a number using these steps :
Step 1.
Open Application http://localhost:4723/wd/hub platformName=Android platformVersion=5.0.1 deviceName=4a119f6b appPackage=com.android.contacts appActivity=com.android.contacts.DialtactsContactsEntryActivity
Step 2. AppiumLibrary.Click Element name=Keypad
After this I clicked on each number one by one and then clicked on dial button.
Where am I stuck?
In similar fashion I am trying to automate Call receiving feature. I'm dialing from some other phone on connected device and while phone is ringing I'm trying to capture screenshot of xml using uiautomatorviewer.
It is not capturing it.
Is it the right approach?? Is there any other way to automate this functionality?
This depends on your screen mode when you receive it:
If the screen is asleep, i.e., when a call is received it opens the activity to deal with the call, then you can detect what is the package on the screen and match it with the package of the call activity.
If the screen is awake, i.e., when a call is received you see like a small pop up on the top of the screen with the "Answer/Reject" options, then UiAutomatorViewer can't detect them. I don't know if Appium can detect it or not, but I suppose it can't (UiAutomator can't for instance, it can only detect what UiAutomatorViewer detects).
In summary, if a new app is opened, you can detect it is the call app. Otherwise, the "popup" isn't detectable.

How to close/send to background Activity from another App in Android?

I am trying to build an AppLock like Android app but I encountered a difficult problem (for me): I managed somehow to detect when a given app is launched, by polling the system log, and bring to front a lock screen, on top of the launched app. My question is: how can i dissmis the launched Activity which must be protected (and, of course, the lock screen) if, for example, an invalid password is provided for the lock screen or the back button is pressed before entering a password?
I have tried using killBackgroundProcess with the correct package name, but it doesn't seem to work and I can't find a relevant answer anywhere.
And one more question: is it, somehow, possible to totally prevent an app from launching, form my app rather than covering it?
Well I found an alternate solution that works like a charm! Instead of dissmising a blocked app, in case an invalid password is provided (for example), I simply bring to front the phone's home screen which implicitly sends to background the blocked app. Hope it will help others with the same issue.

Android Home button disable when Custom lock screenis ON in android

My requirement is to create Custom LockScreen, using below link http://code.google.com/p/contactowner/source/browse/#svn%2Ftrunk%2Fsrc%2Fcom%2Fappengine%2Fparanoid_android%2Flost i am able to create working Fine. But my Problem is when i press HOME button it is opening the Launcher screen. (1) How to Block home button in android ? (2)If it is not possible, How few custom lock screen .apks in the android market able to block Home button.
How can i achieve that ?
Appreciate your help...
You cannot intercept the key and do this unless you have access to the android source code and can change it. From an app's perspective, you can't do this unless you have the source either. Keep in mind that this is Frowned upon in android.
So the only thing you have available is onUserLeaveHint() which is a method from an Activity. But you still CANNOT stop a user from going home.
Ref:
http://developer.android.com/reference/android/app/Activity.html#onUserLeaveHint()
Here is proof that you cannot do it directly
public static final int KEYCODE_HOME
Since: API Level 1
Key code constant: Home key. This key is handled by the
framework and is never delivered to applications.
Constant Value: 3 (0x00000003)
actually it is possible to block the home button , as locker replacement apps do (like this one and this one) . however , they do it using a sneaky way which might not work on some devices and/or future versions of android (hint: look at the code of android OS - where and when in the entire runtime of the OS is the home button being blocked from the user?) .
that's why the best thing to do in order to do it nicely is to capture the home button by acting as a launcher . then , when it's time to unlock the locker , you call the original launcher.
another advantage of using this method is that the locker will "stay better" in the memory and will be the first one that will be launched upon bootup (no need for special permission for bootup ) .
it's possible!
use window params setType(TYPE_SYSTEM_ERROR) and you'll get what you want.
JoxTraex is probably right , you shouldn't disable HOME key, or else users will report your app in future
But there is a way to detect home button press,
Check the answer to this question

Android OS - Stop user from closing app or using any OS functionality

My team is trying to build an Android application for a tablet that will be dedicated for this sole purpose. One of the requirements is that the application is the only thing running on the device (at least from the user's point of view). The user should not be able to close it or use any other functionality from the OS (settings, other apps, etc.).
We have been doing some research and so far have not found anything. Is this we are trying to do even possible ? Does anybody have any idea how we could approach this ? Maybe blocking the buttons ?
Thanks,
It is possible but would be ugly in the long run without a custom built rom (http://xda-developers.com has instructions on how to do this), I wouldn't know where to start code wise - but there are a couple of applications which portray this kind of functionality - TodlerLock is one such app - its designed to stop todlers from from doing anything on the device, whilst the application keeps them entertained. It appears to intercept all button presses and acts as a home application to do this for the home button.
Then there are the programs like estrongs security manager that allows a user to set a password for some or all applications and basically stops the application being run without the password (it appears to intercept the intents and opens the security manager requesting the password first, if it fails it finishes the intent) - this maybe a much easier option to use something like this - you could set a password for most things, including settings and the security application itself, everything bar your application. This will stop the user doing anything you dont want them doing without the password.
You would have to set up the device for the user before hand though, as any home screen intercepter application can be changed but the user - so you would have to set the default, then lock access to the settings so the user can't change this action.
I think the only way of doing this to have your own custom version of Android built only for you. Get the android source, remove what ever you don't want and build it. I am not sure if you would ever want not to close it but you can make sure they can't install anything else on your ROM.
Im not sure about this, but, intercept the home intent and write your own custom home?
It sounds a lot simpler than writing your own custom rom.
This is not possible without OS changes. You cannot override the home button.

Categories

Resources