I want to disable USB access to an android device.
If the device is connected to a computer it should only charge and prevent any data transmission. So no one can access the data on this device.
I read here, that I can change the usb settings by changing entries in the settings database.
I want to do this programmatically, because I want to turn usb access on and off (the button for this will be secured by a password).
My app runs as system app and has the permission to executute the following function.
Settings.Secure.putInt
After changing "mount_play_not_snd" with above function, I looked into the database using adb shell.
The entry
5|mount_play_not_snd|1
was gone.
But I found a new entry:
37|mount_play_not_snd|0
So I think the old entry was deleted and the new one was inserted at the end of the table instead of altering the existing entry.
Are there any side effects of the changed _ID?
Or is there a way to manipulate this database programmatically without changing the _IDs of its entries?
My device runs Android 4.4.4. Maybe the bahavior is different on other systems.
Related
I would like to create logfiles of the activities on my Android phone.
The goal is to be able to trace back any suspicious activities of apps and check if the phone's been hacked.
In this question someone suggested using a proxy server.
But using a proxy changes the ip used and a lot of services (i.e. Netflix) block mobile traffic coming from either server ip's or home ip's when making mobile requests.
The question is already 3.5 years old so maybe the options have changed.
As for the network traffic an option to setup a local proxy on the device itself with a possibility to set logging rules would work though.
How could you setup a local proxy on an Android device?
However this is only the first part as to find possible suspicious activities. But without logging the actual phone activities it will be difficult (or impossible) to actually find out which malicious code or app is doing this.
How can we log activities on Android?
I think when loggin all user activities like touch events etc. and all calls between apps would suffice.
Can this be done without rooting the device? And if not how would one do this on a rooted device?
I would prefer to have this device independent, but I use an Oneplus 6 with Oxygen OS.
I have a android app.And i want to redirect app's traffic to another server without root my phone.I also don't want use vpnservice because it will display a remind info.like Android hacking: hooking system functions used by Dalvik
Given that this is your own app, you can simply write it to funnel all network operations through a single point in the code (or at least a very few) and have a mode that alters or re-writes network names and URLs there when in testing mode, or whatever abnormal mode for which you want to do this.
What I would like to do is create an app on the Android that allows the following:
Allows the phone to have two unlock pin codes. One unlock code will the the master "normal" code. The second unlock code will allow the user to receive and send texts, make and receive phone calls, store pictures, and contacts that will not show up in the "normal" screen.
You cannot do this with an app. Apps cannot change system behaviour unless they are 'system administrator' apps. Even those cannot do such fine grained control, only impose restrictions on unlock code strength, camera use and device encryption. As others have noted, Android 4.2 supports multiple users (on tablets only), which gives you a separate unlock code for each user. Additionally, some operations that affect the whole device, such as adding new users, adding or removing trusted certificates, accessing the secure element, etc. are reserved for the first/primary user. You can't place calls with a tablet though, so multiple users doesn't really apply to calling/SMS.
I read this question and wondered if the same would apply to my situation.
I want to write accelerometer values (x, y and z) from an Android phone to a database and retrieve it with another app on a tablet to display a graph of the values changing over time. This does not have to happen in real time.
So basically my questions are:
1) can two different applications on two different Android devices use the same SQLite database?
and
2) how do I specify an IP so that the one app on the phone writes to a specified database and the other app on the tablet reads from that same specified database?
I can already read the Accelerometer values and I know how to create a graph, but I'm having trouble with the database component of my project since everything I come across seems to be storing the values on the device's SD card or in a database that is only accessible to the device itself and no other applications or devices.
I've read about specifying a static IP by first obtaining a ContentResolver:
ContentResolver cr = getContentResolver();
then adapting the settings:
Settings.System.putString(cr, Settings.System.WIFI_USE_STATIC_IP, "1");
Settings.System.putString(cr, Settings.System.WIFI_STATIC_IP, "6.6.6.6");
and then enabling the permissions: WRITE_SETTINGS and WRITE_SECURE_SETTINGS.
but I'm not sure where exactly to write this or how to use it correctly.
Please direct me to where I can find some more information regarding setting up SQLite databases and how it can be used by two different applications on two different Android devices?
Thank you in advance.
P.S. I'll update this question with some of my code soon.
can two different applications on two different Android devices use the same SQLite database?
No more than two Web servers running on two different continents can use the same MySQL database. Only processes running on a device with filesystem access to a file can read and write to that file.
how do I specify an IP so that the one app on the phone writes to a specified database and the other app on the tablet reads from that same specified database?
You don't. Android is not a server platform.
At best, you might be able to pull this off if both devices are on the same WiFi LAN, and you write a Web service that exposes a database from one device. This, of course, exposes you to the same security issues that you would have with a Web server, without the benefit of firewalls and the like.
I want to write accelerometer values (x, y and z) from an Android phone to a database and retrieve it with another app on a tablet to display a graph of the values changing over time. This does not have to happen in real time.
Hence, you do not need two devices to access the same database. You need them to work with the same data.
So, you could have the phone send the data to some server via a Web service, and have the tablet retrieve the data from that server via the Web service.
Or, have the phone send data to the tablet via Bluetooth.
Or, if you feel the security is adequate, have the tablet expose a Web service via WiFi that the phone uses (though this really scares me, particularly if the tablet might join some other network, such as by being moved).
In neither case does the phone nor the tablet necessarily even have a database, let alone try to directly share it.
A SQlite database is private to the application which creates it. If you want to share data with other applications you can use a Content Provider.
Although not SQLite, I believe this can be achieved using PouchDB, where you would host one shared remote database which would then sync to two seperate databases for each application.
https://pouchdb.com/
There is restaurant, and I have wrote app for them. Now my task is to create device communication: only single app (on a single device) should work at one time. I.e. when user starts to use application on one device, apps on other devices should show warning "Please, wait...". How I can do this?
I am thinking about creating lock-file on some server (maybe on dropbox open folder???). At start app should look to this folder and if the lock file is exists - wait. If there isn't lock file - app will create it, performs all users tasks, delete lock file, and closes.
Another idea - is to use bluetooth connection... Maybe at starting app should seek for bluetooth device with special name... if it isn't - open bluetooth communication with that lock-name and begin to work... But the problem is the device os 1.6.
I think you're on the right track, but maybe a little far down the development path to think of this now.
Anyway, create an exclusive lock that you expose in a webservice you've deployed on apache (obviously, that service will also expose an unlock method too).
Use a local wifi network (one you install in the restaurant) with a tiny linux box and you're in business.