Adding functionality to existing (closed-source) applications on Android - android

I want to add some functionality to existing (closed-source) applications on Android. For example: adding an item in the context-menu.
Is this possible? My guess is to hack my way into the Dalvik VM, but I can't find any information about it.

Is this possible?
Generally, no. If the "existing (closed-source) applications" have an API that they publish and document, you are welcome to use such an API. Or, if the "existing (closed-source) applications" are leveraging so-called implicit Intent actions, like ACTION_SEND, you can simply support those interfaces.
For example, many applications have some sort of "share" menu item or button, which brings up a list of applications capable of sharing the content the original app wishes to share. This is accomplished via ACTION_SEND, and if you create an activity set up to respond properly to ACTION_SEND requests, your activity can appear in this list automatically, no hacking required.
My guess is to hack my way into the Dalvik VM
Fortunately, that will not work. You cannot "hack [your] way into the Dalvik VM" running in another process.

Generally, I can say that you can. You should find the application, disassemble (dedex) it, make changes and build it once again. You can look at the different tutorials how do this.

Related

Activity view for Android

Currently I am building an app and in IOS the users get the choice, what to do with the content. The most important activities are 'Copy' and 'WhatsApp'. Options are given through the activity viewcontroller as seen in the example image below:
This is build in Xamarin so the activity view controller is called through an IOS dependency. I am not very familiar with Android and I was wondering if android has something comparable?
(And what is it called, I could not find any hits on google with android and activity view)
If it exists and I know how it is called, I can use it for android in the Android dependency.
In Android, you can "talk" to other apps even if you don't know them, simply by telling the OS, "Hey, I have this data type, that I want to share, can you show the user apps and actions that can handle it so he/she can decide?"
They are called Intents (get it? :p)
Anyway, there's basically the official documentation about how to do this. So I suggest you refer back to it (and other readers of the future) for things may change between releases.
The short answer is: fire an intent indicating what you want to share, and let Android do its thing.

How to overlay information on Android's launcher app?

I want to create an accessibility feature for Android where a hint appears whenever a person presses or long-presses on an app icon. To do, this I have a few questions:
How to identify when a user clicks on the icon of an app on the
homescreen or app launcher?
How to make use of this event to then
pull appropriate information and present it to the user?
Do I need to develop a custom launcher app to be able to identify user presses etc.? Or can I somehow retrieve this information from whatever launcher a user uses and give the hint?
There are a couple of different ways to get after the information you are looking for.
The first option is to create a custom launcher, as you suggested. This has obvious drawbacks. Most obviously, having to re-create an entire launcher applications is obviously difficult, and likely to create more issues than fixes. You could search out an open source launcher application, and attempt to add your feature to this, however you'd then be reliant on the purveyors of this codebase to accept your feature.
The second, and the way I'd recommend, to access this information is through accessibility services. This information is available to services like TalkBack. It is essential to how they function. The difficulties you'll face here are interacting properly with the numerous launchers available out there. However, most of these launchers are based off of a similar starting point, which is the Android base open source launcher. As such, the portions of the launcher that you care to interact with should be coded very similarly in most launcher examples.
The downside to this approach is that only one accessibility service can be active on a device at a time. So, users who are partially blind, who may want to use your feature and TalkBack at the same time, won't be able to. It is of course to you to determine which set of difficulties/benefits you'd prefer to deal with, but these are your options.

Dump the tree of Views present at any given moment [Android]

I am trying to archive same thing as done in "hierarchyviewer" tool, which dumps the tree of Views present at any given moment on the device or emulator screen.
But i want it to be an Application running on a Android device. This app will keep running in background like a Serve and will dump the currently displayed Views in a text file.
Is it possible? is there any code examples are available?
Is it possible?
No.
The closest you can come is to implement an AccessibilityService. This would more closely mirror the uiautomatorviewer functionality, giving you a subset of what you see in Hierarchy View. This also requires a double-opt-in by the user: the user must install your app and activate it in Settings in the accessibility area.
As far as I know, you couldn't access other apps if they do not explicity share that info with you by the use of Intents (or if you own these other apps).
So, based on this limitation, my bets are you can't access another app's View Tree by regular means. And if you chould, I think you shouldn't, as this is somehow "secret" to other apps, and you'd be registering information without permission. In fact, what hierarchyview uses is, for sure, some sort of trick that directly uses internal private libraries of Android. Like taking a screenshot, that you can't do with the "default" implementation, but using these kind of testing tools.
That being said, check this answer, where it shows how to get the current app in foreground. From here, getting the View tree should be impossible, but as long as you could call getWindow() on that app's current activity, this could be done.

How can I determine what Intents a third-party app supports?

I'd like to invoke third-party apps to enhance my own. For instance, I'd like to allow users of my app to use programs like CamScanner to capture images as an alternative to the camera. I'd like to be able to suggest recommended third-party apps that work well as intent alternatives to bring better functionality to my app.
Is there a public manifest after installation or better yet some indication in the Play market page for the app that shows which Intents it supports?
there is http://openintents.org - if it is listed there.
You can learn about activity names from the system Settings/Applications screen.
No matter what, you'll be able to invoke their main activity, like this:
startActivity(getPackageManager().getLaunchIntentForPackage("com.theirpackage"));
Now, non-main activities that are not explicitly documented are another matter. Even if you get the manifest text, this might or might not help you figure out the invokation protocol; the activity might rely on intent extras that the manifest says nothing about.
And no matter what, you never know if the activities in the app rely on a certain order of invokation. Unless an activity was explicitly built for third party reuse, you never know if it's ready for reuse. I can easily envision the scenario where an activity relies on a static variable that's initialized in another activity, which is always started first over the normal flow of the app. If you invoke the dependent activity out of order, be ready for crashes.
That said, it's fairly easy to get the XML manifest for an app. First, get an emulator image with Google Market in it (search around, those are all over the 'Net), or a rooted device. Install the app from the Market. Pull the APK from the device using ADB or Eclipse. Then use the apktool to take the APK apart. It decompiles the manifest into a readable XML form.
In case of the CamScanner app, it exists a public API.
https://dev.camscanner.net/
It requires to sign an agreement.

Is there Android Intent concept in iPhone SDK

Just switching from Android to iPhone. In Android I can make several apps and use a tabView to call each app as intent.
In iPhone, I can make several apps. I need a tab to call each apps or app views. Is there similar concept as intent in iPhone? Just switched to iPhone, copying all the other projects into the tabbar does not work out. If you have other methods to solve, I really appreciate. Thanks,
Android and iOS are very different in this regard. Android is very open about letting you use intents to mix and match activities from other apps. iOS isn't like that; each app runs in its own private space and generally cannot even see other apps' data, let alone use their services. It is possible to cause other apps to run via custom URLs, but that's not the same thing.
What you'll need to do is to copy or move the code for the view controllers, views, etc. of your various iOS apps into your tab bar app project. You'll build them all into a single application, and the tab bar will switch between the view controllers.
With iOS 8 you will have something similar to Android Intents. Using App Extensions you can reach similar behavior.
In a close future Apps will start expose their "extension" (as you do in Android Framework declaring Intent Filters in the manifest) that will be used by application who need.The extension areas allowed in this first version are:
Today
Share
Action
Foto Editing
Document Provider
Custom Keyboard
It's great finally apple release this functionality!
Intent in Android covers a lot of functions. There is no iOS equivalent to that.
But if your objective is to launch a different app, and pass parameters to it, you can try out URL Schema.
Let's say you have app AAA with URL schema aaa:// and app BBB with URL bbb://
You can launch app AAA, and call bbb://v=1&c=2 for example, to launch BBB and get the parameters. you can even take these parameters to control what view to show, so you can have a similar concept in Android, to call different Activity with Intents.
You have to register URL schema in Info.plist
The closest concept to an Intent on iOS is the handling of certain URLs by the system applications. See here. It was possible to register your own application URL schemes at one point (see this article), but I must admit I haven't tried this in recent SDKs (IIRC Glympse links can be opened in the Glympse app, so this technique probably still works).
As of 2016, Apple has added an Intents framework that is similar to Android's, albeit much more restrictive. Expect Apple to add more Intents in the future, but for now it is quite limited. https://developer.apple.com/reference/intents
Since iOS 8, you can use App Extensions.

Categories

Resources