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.
Related
If we look at one activity as a graph node, transition/calling from one activity to another as a graph edge, one android app can be conceptually converted into a graph. I am trying to see if there is any way to create such a graph starting from the first page/activity of an app.
Let us say we can use android UI test automator to help if needed.
I am trying to see if there is any way to create such a graph starting from the first page/activity of an app.
It would be exceptionally difficult.
I am assuming that you are trying to hack... er, I mean, "analyze"... somebody else's app. In that case:
You have no idea how many activities there are, unless you are reverse-engineering the APK. And even then, you have no idea how those activities will be used (e.g., legacy app that is putting activities in tabs and not using them as an ordinary activity).
You have no way to know what triggers the activities to appear. For example, a certain activity might only appear via an "Easter egg"-style bizarre set of inputs. Some might be triggered by things outside the app itself, like a Notification or a third-party invocation of ACTION_VIEW for some MIME type the app supports. And some of the triggers may be dependent upon other inputs (e.g., a disabled action bar item that becomes enabled only if you have set up an account elsewhere in the app).
With full source code, you could do static analysis to find all startActivity() and startActivityForResult() calls, and for simple variations you might be able to divine which activity starts which. Even that could get tricky in some cases, for complex Intent construction.
I want to be able to tap the statusbar and the contents in the displayed app to be scrolled up to the top.
Is it technically possible that an app intercept my tap and send the appropriate command to the active app? I have noticed for example that AntTek quick settings shows a drop-down window when swiping down from statusbar. While using the app I did also notice that even by just tapping the statusbar (before beginning to move the finger down), the app seems to already interact with the touch as it dims the screen brightness in preparation to display it's "window" (sorry I use the MS Windows term), so clearly a statusbar tap CAN be sensed by an app.
Starting from this, I wonder if such an app could then send a message to the active program telling it to scroll up.
Is that possible? And if yes, the message must be customized to a particular app (let's say the browser as the most important) or is it standardized so the apps speak the same language between themselves?
I am not a programmer so answers with codesamples might be less helpful than a plain english explanation. Finding out that is possible would lead rather to pursuing a programmer to implement the idea rather than starting to develop it myself.
Thanks :-)
There is an XPosed-module which seems to do exactly what you want.
To use XPosed-modules, you'll need to root your phone and install the XPosed-framework.
The XPosed-module is called "Statusbar Scroll to Top" and its repository can be found here:
http://repo.xposed.info/module/com.mohammadag.statusbarscrolltotop
This will work for almost all app-lists, but for example won't work for browser-content.
If you want to scroll to the top of the page in a browser, then you'll probably do best to get a browser which can do that on its own. (For example Habit Browser has it built-in and respective plugins are available for Firefox.)
Yes it is possible. HiroMacro and Frep can do this, but it requires root. https://play.google.com/store/apps/details?id=com.prohiro.macro&hl=en
(how do they simulate mouse and keyboard interactions on other applications? i have no clue :/ anyone?)
Is it technically possible that an app intercept my tap and send the appropriate command to the active app?
No. One app cannot send fake input to another app, for security reasons.
An android app comprises of several activities. Each activity display a GUI that allows the user to perform a specific task. To take the user from one activity to another, app must use an Intent to define our app’s intent to do something.
An intent can be explicit in order to start a specific component (a specific Activity instance) or implicit in order to start any component that can handle the intended action.
Interacting one app to other app in android
google docs link
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 any way to programmatically pause an Android app in Phonegap? I would like to mimic the behavior that occurs when you hit the HOME button. I've already had to overwrite the back button handler using this, and while in most cases I want it to do my action, when in a particular state the user would expect the app to minimize, and I want to replicate this behavior.
Keep in mind, on Android this is not the same as closing the app. That is quite easy to do with device.exitApp(); but I would like it to remember its state and keep running in the background. Especially if there's still an asynchronous job being done in the background.
Is there a feature in Phonegap to achieve this?
Possible duplicate of Manually pause an application in Android Phonegap, but I couldn't find some of the tools the OP mentioned there such as navigator, so I was nervious to totally edit and rewrite their post
The simple answer appears to be: no.
However, for anyone else that comes down this path, its not impossible. It's just that there isn't a feature of Phonegap to do it for you.
The Android equivalent of "sleeping an app" is actually just opening another intent. Specifically, opening the "Home" intent would sleep the running app and bring you back to the home screen. But as far as I can tell from asking around and scoping the docs, Phonegap doesn't have a direct way of opening intents.
What you (supposedly) can do is one of two things:
This plugin is supposed to be promising
Call the Java code that does it yourself using the means described here
Mind you, as of right now I've decided to not go any further with this, so I make no promises about either of those means, having not attempted them myself.
I invite anyone else who decides to pursue this further to update their experience here.
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.