I have a mobile phone with dual sim. If I want to turn on Airplane mode, its happening for both sim.
Is it possible to do for only one sim (user can select the one of the two) programmatically? I saw the posts over here, that they work till API 16. Any other work arounds?
As I can see this in the docs:
Some device settings defined by Settings.System are now read-only. If
your app attempts to write changes to settings defined in
Settings.System that have moved to Settings.Global, the write
operation will silently fail when running on Android 4.2 and higher.
Even if your value for android:targetSdkVersion and
android:minSdkVersion is lower than 17, your app is not able to modify
the settings that have moved to Settings.Global when running on
Android 4.2 and higher.
They say Settings.System are now read-only, but reading these blogs,I don't need your permission!, which explains how to skip the permissions part, by this way we can ask the user to give permission to turn on/off the airplane mode and escape the permission issue mentioned here?
Thanks in advance.
Is it possible to do for only one sim (user can select the one of the two) programmatically? I saw the posts over here, that they work till API 16. Any other work arounds?
There's no official Android API which supports this. Additionally, I'm not aware of any vendor/device specific SDKs which provides such an API.
They say Settings.System are now read-only, but reading these blogs,I don't need your permission!, which explains how to skip the permissions part, by this way we can ask the user to give permission to turn on/off the airplane mode and escape the permission issue mentioned here?
The example in this blog post has nothing to do with airplane mode.
Edit: Please also note that airplane mode isn't related to the SIM cards but to the connectivity hardware, e.g., Wi-Fi, Bluetooth, or cell radio modules. Thus, when enabling airplane mode this hardware is turned off. Depending on the device only one cell radio module might be built-in which would make it impossible to restrict airplane mode to a single SIM card.
Related
We're trying to develop an app that's going to mark students presence. In order to do this we're using bluecove to detect the students phone but the phones are only discoverable for 120s.
We've developed an Android app that keeps it going forever, which works but uses too much resources. Does anyone know a better way to do this? Currently we're trying to detect phones that have once being paired and are not discoverable, Bluetooth is on. Our last option is to just mark the presence at the beginning and end of class.
I don't think its possible to detect a Bluetooth device which is not discover-able. Therefore, you can have an app that detects the phone IDs and bind each ID to a pupil upon discovery and from your register from that. This wont work unless their phone is set to discover-able. So either ask them to turn it on or just record manually.
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
I want to toggle the the mobile data button that can be seen when you pull down the menu strip. I have tried a couple of examples, but none seem to work. (How to disable Mobile Data on Android as an example). Is this simply not possible and if it is not possible, how would I go about disabling all connections?
First of all you might check the status of mobile data and consequently enabling or disabling them.
To check the status see this answer and to toggle the data see this.
Remember to add to the manifest all permissions and keep in mind that this method is no longer available on android 5 (Lollipop).
Is it somehow possible to set Android to standby-mode programmatically ?
If you're developing your own ROM or you have a rooted phone (it's need to be checked which user is able to do this) then you should have a look to the PowerManager.goToSleep functionality. Here is a discussion about this function in the Google Groups. And here you can read about this particular permission.
http://developer.android.com/reference/android/os/PowerManager.html#goToSleep%28long%29
This is what i think you are looking for.
Don't forget to include following permission.
android.permission.DEVICE_POWER
This functionality has been removed since API level 21: https://developer.android.com/sdk/api_diff/21/changes/android.os.PowerManager.html
Like Yury also mentioned, before you were able to call powerManager.goToSleep(time), but you would have needed a rooted device or app would have needed to be signed as a system app to acquire the relevant rights.
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.