How can I force touch events on none routed Android devices - java

I would like to write an application which can programatically generate touch events on the phone.
I have already tried this methods:
adb : adb swipe and so on... It requires USB cable and connect the phone to pc
adb ON TCPIP: same
My problem with adb is to require so much presetting by user and I don't want to make the user to learn it. I have already made an application which use adb, but it's difficult for the user to set up properly :(
I have heard and I tried to sign my application with platform sign, but it's not good for me, because I would like to publish my app on android market and it is not a system application...
I would like to find a way to achieve this in a single application which can produce touch outside of the app (from background) and I would like to publish on market.
I have found this application: https://play.google.com/store/apps/details?id=com.teamviewer.quicksupport.samsung which can basically do this. Because when I click on my computer, it send a message to the phone and the phone make the touch on the screen. How and with what privileges can teamviewer do it?
Please give me some advice about it.

I would like to find a way to achieve this in a single application which can produce touch outside of the app (from background) and I would like to publish on market.
This is not possible, outside of what little input faking can be done by an accessibility service.
How and with what privileges can teamviewer do it?
If your read that Play Store listing, you will notice that it only works with Samsung devices. That is because the makers of TeamViewer struck a deal with Samsung to enable this sort of integration. Similarly, the TeamViewer team struck deals with a few other device manufacturers. However, they did not do so with all manufacturers, and so TeamViewer does not work on all devices.

Have a look here .This might be useful.
InputInjector
Android library that eases the process of injecting InputEvents (MotionEvent, KeyEvent) to you Android app. The library uses internal API calls to inject events and depend on the accessability of these. This library will therefore not work on all devices but theoretically support Android 2.3 and forward (API level 9-18+).
Androd 2.3 (API level 9-15)
In older versions of Android we envoke the same system calls as used by the Instrumentation framework.
Permission No special permission needs to be set.
Androd 4.1.2 (API level 16 and forward)
As of API level 16 we have access to the InputManager class. We use this as the basis for the input injection.
Permission Using InputManager for injection requires setting permission android.permission.INJECT_EVENTS in your manifest.
Using this permission may require altering Lint Error Checking in order to be able to compile. In Eclipse this is done by going to Window->Preferences->Android->Lint Error Checking and then finding ProtectedPermissions and setting severity to something else than error.
NOTE: In order to inject events to other apps using InputManager, your apk must be signed with system level certificate.
https://github.com/arnebp/android-inputinjector

Related

Screenshot of the device screen Android from service

I am working on an Android application This application is a parental advisor application and it will be installed on the parents' phone and on the child's phone.
My question is how will the screenshot be taken from the boy's phone without his knowledge?
thats pretty high privilege, which need special permissions. you probably have to create AccessibilityService, but be aware, that Google Play may refuse your app from publish in their store. btw. you can't start this Service from the code, user must enable it in system Settings

Is there an API/Library that will return the Authentication Level of an Android Application

I'm currently writing an android app where I use PackageManager to get all of the installed applications on the device. I want to order them in a recyclerView based on their level of authentication (if they require a fingerprint, passcode, or facial recognition to use). Is there any library or API out there that can get me close to something like this?
Thanks!
Is there any library or API out there that can get me close to something like this?
No. You can use PackageManager to see what apps request the USE_FINGERPRINT or USE_BIOMETRICS permissions. However:
You have no idea to what extent the app is using those permissions
That may not cover device-specific proprietary SDKs (e.g., Samsung's)
You have no way of determining if an app requires a password or other forms of authentication

Single application custom Android ROM

I find this question a couple places on the web, but never with a good answer. Let me be specific in the questions asked.
I want to build a custom Android ROM which only features one app. This app is not to interact with any hardware (per now). This app will be launched on the start up of the device. No locked-screen. The device will have to restart if the app malfunctions.
A resource told me that you can change the launcher app of the ROM.
-> Does this mean that the home screen, the one which displays all apps on our phones, is merely another app? If so, can you simply change the launcher app as it is stated here? What were to happen if this app fails?
If this is the case, it would solve the entire issue.
If not, how do you go about making this sort of project? It includes
Making an app on AOSP
Refuse users to leave the app or interact with anything else
Making this app part of the boot-up process
Remove locked screen
Make the app a dependency of the OS (to force shutdown if malfunction)
Thanks in advance for any replies
I just found Android have a topic about dedicated devices (formerly called corporate-owned single-use, or COSU) are a subset of company-owned devices that serve a specific purpose. maybe that can meet your requirement.
BTW, After into the sub-topic lock task mode that mentions about set DPC whitelist APPs and the device policy controller (DPC) needs setup by other steps.... FYR~

Is it possible for an Android app to restrict other apps to WiFi only (without root)?

I was wondering if it was possible to make an android app (that does not require root) that could enable and disable the use of mobile data for other apps? I know there's a function to toggle background services per app inside the native Android settings, so maybe there's some public methods for me to do so with my own app.
Basically, I want my app to control whether other apps could access data via mobile data or WiFi only.
Pointing me to the right direction would be greatly appreciated as well.
Theoretically, yes.
See: https://github.com/android/platform_frameworks_base/blob/dbc51de44fe4f9a7f81528204250de32ec405d39/cmds/svc/src/com/android/commands/svc/DataCommand.java
This is the svc tool that can be launched via adb shell. It did error out with code 137 for me (unrooted Nexus 5), though. But from the code you see how this should theoretically work.
You retrieve the TelephonyManager and enableDataConnectivity, which is, of course, a hidden API (see: https://github.com/android/platform_frameworks_base/blob/6b8a3a52acf1c2722551f1ea1ce47831f87939cd/telephony/java/com/android/internal/telephony/ITelephony.aidl). Accessing hidden APIs is possible by recompiling the android.jar that you build against, or by using reflection (see: How do I build the Android SDK with hidden and internal APIs available?).
Hope this helps.

Is it possible to set pin programmatically for bluetooth pairing?

I have an application (however I'm testing using the sample bluetooth chat from the SDK) where two android devices connects each other, and exchange data.
I already have part of the pairing process hardcoded using the BT address, problem is: the dialog it appears to confirm the pin. Is there a way to make that work programmatically? The only thing that "appeared" to solve my problem was in this question, but that API is completely abandoned, has no documentation and many issues.
As fair as I know the problem is that if the device is not the device database with paired devices, without root access the standard API is always going to prompt the user, but I'm still wondering if there's a way.
Bluetooth autopairing is defined only for some devices. To change this you should rewrite Android framework. So, from the application, it seems to me, this is impossible to do.

Categories