Default Android host files block Google Analytics? - android

I've been working to get Google Analytics v4 set up in my app, but I've been having a few problems.
I'm working with a Galaxy Nexus phone and Google Analytics is being blocked by host files created by AdAway.
The problem is that I'm don't think I ever installed AdAway and IF at some point maybe I did (or someone else did it on my device) the host files are still on my phone even after doing a factory reset.
Why would the host files stay on the device ever after resetting the phone?
This is frustrating because I don't see any reason the host files should still be on the on the device and I'm not able to easily collect data on the device about app usage.
Does anyone have any advice about why the host files from AdAway would still be on my device even after resetting it?

Just reinstall AdAway - if you believe it's the cause of the problem - and select Disable Ad Blocking. This should restore the original hosts file that came with your Android firmware.
If that still doesn't work, then you can manually edit the hosts file to give you access to Google Analytics. The hosts file is located at /etc/ directory. Use a file explorer to navigate to this directory and edit/save the hosts file with a text editor.
Note: You'll need root permission to edit the hosts file under /etc/ directory since this directory is reserved for system apps or access with root privileges.

Related

Auto install Android App after copying to SDCard

I know this is may or may not be possible,but I just want to confirm is it possible in android or not?
So here it goes,Let's say I have an android app ( example my_app.apk) ,I copied my_app.apk from my computer or through pendrive or downloaded from website to my android device( let's say I copied to /sdcard/).I have also activated install app from unknown sources in my phone settings.
Now is there any way through which I can make the App to auto install on the device as soon as I copied to /sdcard folder? I mean my_app.apk should kick auto installation on the device without user navigating to /sdcard of the device and selecting the app and clicking the install option.
I just want to know is this possible in Android? if Yes how can I achieve that? I don't want to use other third party applications to kick off installation,instead the app should kick installation itself as soon as it gets copied to /sdcard folder.
Any help would be appreciated.
I think that is not possible. It is possible to have Android app which checks some folders and detects new file and automatically install new apk files. To install apk package ordinary (from SD card) you should activated installing from Unknown sources in settings. Auto instalation packages aren't possible, because it could be security problem.

How does Android File Storage Work?

I am working on a project that needs to store some .txt to android, and get it from the computer for other use. From what I read from the documentation, I know that there are two types of storage: 1 Internal, which is somewhere deep in the phone that is private to the app. 2 External, which includes the SD card and the Internal Storage of the phone. I want to store it to External->Internal, and I am using this line of code to do that:
public String WalkDir = android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + "/Walks/";
When I logged WalkDir, LogCat says "/storage/emulated/0", I stopped the app, checked with the adb shell, and there is no folder "0" but "legacy". I unplugged the phone and plugged it back in, the "Walks" folder is now in the root directory, and I don't need adb shell to access it.
So my question is, can you help explain how this system works? Why did "0" disappear? What is "legacy"? Why is the file in Internal Storage when I unplug&plug it?
Thank you very much!
Those are what in Linux are called symlinks (like shortcuts in Windows) that various system apps in Android are using..
/storage, /sdcard are sym linked folders,that means when you open one of those, it redirects to the original(/data/media/0), as for the 0 is just a multi user feature implemented in android 4.2, but only enabled on tablet androids.
Why do this Sym-Link?: simple so it dosent break apps(not only file explorer type of app, but all apps).
Still dont get, why it would break?.Simple. android api have lots of ways to write/read files from folders, u can do manually,u can get the data path, u can get the sdcard path, etc,etc. so to not break that they just does these sym links, thats why in one app the storage contentents are listed on /sdcard but on others, is /storage, etc,etc. one example of an app that broke because of these changes to android is titanium backup, u need to change the internal storage on it, so it work.
2 mount points pointing to the same storage device and partition.
If you create something in one folder, it will show up in the other. Same applies for deleting stuff.
They do not take away more storage space, as it is only available once but shown twice.
You also don't need to worry about it in any way because file browsers normally set their default directory to one of these locations.
As far as i know, Google changed the mount points in Android 4.2 to /storage/emulated/0/ due to them switching to MTP and EXT4(?) for the sdcard. The other mount points are still there for compatibility.

Accessing files from genymotion sd card

I have been using genymoton for quite some time now.
Could someone pls. tell me if there is a way by which I can access the files present in the sd card of genymotion emulator?
Currently I have to upload them to google driver and then download on windows.
You can use shared folder for that. It is well explain on this Google+ post.
Here is the brief:
Go to your VirtualBox VM setting / Shared folder tab
Add a shared folder with the folder you want to shared, and check the "auto mount" option
Start your VM as usual from the Genymotion software
Your shared folder is available in the /mnt/shared directory (multiple shared folders are supported)
This is also possible using the Android Device Monitor.
You already have this if you have the Android SDK installed.
This method works for all connected devices, including emulators like genymotion.
In Android Studio, click the icon that says Android Device Monitor in the toolbar.
(This is also available from Eclipse or you can just type monitor in the command line after moving to the tools folder of your installed sdk)
In the Android Device Monitor, go to the File Explorer tab.
Make sure you have a device selected on the left side.
Find the desired file and select it.
For the sdCard you might need to open the storage folder and open the sdcard there.
Click the button on top that says "Pull a file from the device".
Make sure you select Pull, not Push. Unless if you want to put new files on your device ofcourse.
Save the file to your computer...
and voila! The file from your genymotion is now among your other files on your computer. Ready to be used however you like.
Or alternatively you can also use a third party app like airdroid or any advanced file explorer to exchange files between your device and your computer.
(For installing third party apps you either need to find the apk or flash gapps on your genymotion first and go to the play store.)
Another way that I adopted, just install EsFileEx on genymotion.
Grab your files that you want to copy from e.g
/sdcard/WhatsApp/media/dp.jpeg
Swipe to LAN, here you can see your local machine as 10.0.3.2 or any IP. Here you can access your shared folder/drive of local machine/PC, past copied file here and you done!
NOTE! R/W permission should be set on shared folder/drive of local machine/PC
You can use the eclipse with the ADT plugin and browse the file system like any other android virtual emulators. I have been using this for a while, but eclipse crashes at some times.

Android root access

I have a Google Nexus 7, and I've been developing on it. Only recently, however, have I become unable to access the /data/ directory using the file browser in eclipse. The device was never rooted, but now since I upgraded it, I believe that I have lost access to this. Is there any way to get eclipse to use the "run-as" command to access my app's data directory? How come I have suddenly lost access to this?
Is the only option left to root the device?
Thanks
Is there any way to get eclipse to use the "run-as" command to access my app's data directory?
There is nothing for you to run "as" that would help here, AFAIK.
How come I have suddenly lost access to this?
You should not have had access to it in the first place. If you did, that was a security flaw in the device, perhaps fixed by a firmware upgrade.
Is the only option left to root the device?
You could not browse the /data/ directory on production hardware. For example, you can browse /data/ on the emulator.
I am able to given root permission by installing apk.
http://gadgets.ndtv.com/mobiles/features/how-to-root-nokia-x-and-get-access-to-google-play-store-and-google-now-508391

Preventing file copying on Android device when app is running

So I want to prevent people from copying files out of my app while it is running.
1) Is there an easier way to detect if files are being copied off my device than through checking if the adb daemon is running?
2) Is there an easy way to enumerate all processes running on the Android OS from an app?
I know Android is not a very secure system, but I would at least like to make it difficult for people to copy files off of my app.
EDIT
To clarify my problem, all the files I have stored on the disk are encrypted. My concern is that I need to unencrpyt these files when accessing them in my app. I am trying to prevent someone from stealing these files while the app is running. I already delete the unencrypted files if someone exits out of the app.
Also, I was focused on adb because I was considering trying to delete unencrypted files if connected by usb. However, I know you can still run adb over wifi on a rooted phone. Now that I think about it, you can probably transfer files over by wifi on a rooted phone as well.
Also, obviously not having the files on the device is not an option.
You seem focused on adb, for unknown reasons.
With respect to internal storage, users cannot copy files off of internal storage of a device using adb, unless the device is rooted. And if the device is rooted, they do not need adb to copy files.
With respect to external storage, that is specifically designed to allow any app, or the user, to copy files from it, again without adb.
Hence, trying to detect adb is pointless.
I know Android is not a very secure system, but I would at least like to make it difficult for people to copy files off of my app.
Then don't put the files on the device in the first place.
I'm not sure if you mean that a user would use your application and put his phone on USB mode and proceed to transfer file off your application folder while your application is still running ?
If some files are needed in order for your application to function at runtime, can't your just make them private to your application ? Like illustrated in this article. Or simply don't put files on the device :)
I'm not sure what "copying files out of my app" means (is your app designed to show/provide files, or are you referring to the resources and other files used by your app).
In any case, you're wasting your time. Android is a very open platform and (particularly on rooted devices) people will always find a way to copy data if they want to.

Categories

Resources