Does Eclipse or Android usually pull in other code? - android

So, we were coding an Android application in Eclipse, and we couldn't figure out why a class wouldn't delete. We removed it from the application completely, and it was still there. Then we found out that it was actually pulling in the information from another application. Does this usually happen?
EDIT: More information:
The problem only happened when we built on 1 of the three devices, the one that had the App it was pulling information from. On the other 2, it wouldn't run at all. The other App had a different name, signing key, and was a different project.
EDIT 2: It happened again. There is an app called SMS.apk, and the second is called 2012.apk. The class names are different, and the project names are different. There are no references to eachother in the files at all. But it was pulling in code from SMS to 2012. It worked, until we removed SMS, when we realized that it was using that code. At this point, we are a little worried we accidentally stumbled upon Skynet.

No, Eclipse does not do that. The reason this is happening is most likely because its an SMS app, so you're using broadcast receiver. Heres a tidbit from a helpful book:
One interesting characteristic of the BroadcastReceiver is that you
can continue to listen for incoming SMS messages even if the
application is not running; as long as the application is installed on
the device, any incoming SMS messages will be received by the
application
Source. pg. 273

Related

A single BroadcastReceiver in an Android APK file.

Suppose we have an Android APK file which contains only a single BroadcastReceiver.
Will this form of the APK file be installed on Android devices be installed successfully and can the BR receive intended intents? I thought it will, but my experiment showed it does not. I am not sure why, but the installation of such APK files (with a single BR) seems to fail all the time.
A solution to this problem is to add a dummy Activity to the package. Then the installation succeeds, and the BroadcastReceiver can receive all intended intents!
Please share your opinion on this matter.
I always thanks you all for helps!
Will this form of the APK file be installed on Android devices be installed successfully and can the BR receive intended intents?
No.
I am not sure why, but the installation of such APK files (with a single BR) seems to fail all the time.
No, but the BroadcastReceiver will not receive broadcasts until something has directly invoked one of your components via an explicit Intent (i.e., an Intent that identifies the class). Normally, that will happen by the user launching your LAUNCHER activity. This has been the case since Android 3.1, about three years ago (see "Launch controls on stopped applications" in the Android 3.1 release notes).
You need at least one Activity for landing page in the android app. What are you expecting will happen when the app is launched manually?

Using Android Studio's logcat better, permanent focus on a single process?

When testing on a device in Android Studio you get an awful lot of output in the logcat.
I'm only interested in the output for the app I'm developing. I can see just this, after running, by opening the Devices section and manually selecting my apps process. Problem is, it's pretty tedious to do this every time I run my app, which seems to be the case.
Is there a way to get it to remember this setup?
How about a way to get it to stop reporting anything after I'm done with my app or it's crashed ? (otherwise my app specific stuff gets buried so quickly by output from other proccesses on my phone)
I'm open to other ways of filtering the logcat too, however I couldn't think of a way to set up filters so that I would get my tagged Log messages AND other exceptions I wasn't expecting.
Any suggestions?
Normally this is done by default, but if not,
in logcat, the green plus sign, when you click it you get a dialog, fill the byApplicationName with your package name, and also your filter name with something, now you can filter your output according to your app
with that beeing said, sometimes you don't get the filter column info (application name) in logcat at all (blank), here (and I my self don't know the cause of it) just forget it for a while and retry again

Disable log related to other application/system - android

I am using HTC One X.
There are some system application that has too many logs.
Because of that, I am able to see my application log only for some seconds. After some time, my logs are being remove from buffer since too many new logs from other application.
Can i disable log by using the tag.
Firstly, you cannot stop other applications from logging! Probably some apps more than others log too extensively causing an overflow. What you could try to do is
Force stop some apps so that thier logging activity is reduced(less chance it might reduce).
Secondly, as Rasel suggets,
Use DDMS features like filtering logs using application name, package name, TAG's etc. and pause logging.
In this way you will get a snapshot of your logs. Hope this helps!

Send an sms during apk instalation or when finish it

I wrote an application and I need to send sms. I think that it is a good idea to do it during the application installation or when installation is finished.
It is correct? If it is correct, how can I do it?
Sorry, but you cannot get control during application installation.
This question asked how to intercept an intent during a download. I personally tried by getting the Android Market source code and working on a c2dm hijack, however because it verifies its c2dm transmission with the app signature, it is about impossible (and very much frowned upon) to spoof, and without rooting the phone, you cannot listen to packets coming in on the network interface. Your best bet is to send the text after your application has installed (as described here).

How to detect the presence of another app?

This is a theoretical situation:
I am writing an app to detect the presence of another on the phone
The classpath, name, Activity names etc. of the target app have been randomized, I can't just check if it's there (it is semantically the same but syntactically unique)
I have root access to the phone
The app is open source, and (apart from the package name and application name) I know everything about it.
The app generates no Log output.
I've been thinking of ways to detect whether this other app is present on the phone (assuming it is actually run from time to time), are the following methods feasible at all?
Look periodically for the presence of certain classes in memory
Search for known chunks of the compiled code in each installed apk
Detect the app running by inspecting the memory of the device at certain intervals and look for usage patterns matching the app
Are there any other ways of detecting another app under these circumstances?
Use PackageManager. It has a method returning info about all the apps, installed on the system: getInstalledPackages().

Categories

Resources