How can i know supported intents of the 3rd party app - android

I've built an app called xLancer (https://market.android.com/details?id=kz.jay.xlancer.activity) that retrieves job listings from Elance. Now i want to implement a feature that would remind me to bid on a project at a later time. Instead of reinventing the wheel i want to launch any external TODO/Task manager app. But now i am stuck, i don't know which URI or action should be specified, so far i've only used intents to call my internal activities by specifying class name explicitly.
So the question is: how can i know which URI/action should be specified?

Look here, I didn't see any Todo/Task intents there though....

Related

How does buying an app to enable paid features of another app work?

There are apps (such as https://play.google.com/store/apps/details?id=com.teslacoilsw.launcher) that are free, but whose paid features can be enabled by buying another app (in this case, this one https://play.google.com/store/apps/details?id=com.teslacoilsw.launcher.prime)
How does this work?
My guess is that the free apps launches an explicit Intent and can detect if the app is present via a try/catch structure. The downside of this is that this could be easily circunvented by someone who creates an app with the same package name and specifies all possible Intent filters.
Is this how it works, or is it some other way?
There are various ways to do that. One way is to query a content provider which will be protected with a special permission.
I have released quite long ago on Github a library which helps doing this: Android Unlocker Library.
That's a good option if you are dealing with devices outside the Google ecosystem, however, from a developer experience, in-app purchases offer a much better user experience (and thus drive more sales) according to me.
The easiest way is to use startActivityForResult(...) from app A against an Activity of app B, that must be configured with an IntentFilter in order to be used from an outer app. Inside the B called activity you can also check who's calling with getCallingActivity(). You can find an example here.
Before starting the Activity, you can test that B is installed (using the PackageManager) or you can just start the activity and catch the Exception.
In the called Activity, you can check the signature of the calling package using the PackageManager.checkSignature(String,String) method. Pass the package name of A and B and if the signature matches, execute the logic.

How to lauch android's apps preferences (from Contacts, Messages, ...)

I've been searching and I couldn't find a topic that could clarify me 100%.
My question is: How can I launch an android's app preferences activity (from Contacts, Messages, ...) on my own app?
I give an example:
Imagine I'm developing an app which allows the user to quickly access to Message's Settings. I don't need to send or receive any information, I only need to open the activity, create a shortcut for it.
Someone knows if this can be done and even opening specific locations of the apps?
You don't need to know any specific locations or specific apps for these actions, simply look into Intent.ACTION_PICK.
Picking a Contact: get contact info from android contact picker
Picking a picture: How to pick an image from gallery (SD Card) for my app?
The best answer in this thread has the solution:
android: how do i open another app from my app?
Also check:
http://android-developers.blogspot.com/2009/01/can-i-use-this-intent.html
To open settings, you can try:
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS, 0));
There is no difference in writing in code an Explicit Intent which will go to a specific activity of your app and using the same format to go to a specific activity some other app. A few things to be aware of: (1) The receiving activity may be expecting particular data and fail otherwise. (2) The standard apps you are considering like Contacts, Messages while you can find the source for them in the Android Open Source Project (AOSP) may be changed by the manufacturers so that the activity names and necessary extra data could be different.
In order to maintain as much compatibility between all of the different Android manufacturers, you should stick to the standard implicit intent with the appropriate action/data.

Control an application from another application

I read this question and another question and I understand how to launch an application from another application (Let's call the other application LauncherApplication). However, my goal is not only to launch an application, but to use its functions, so I suppose the LauncherApplication should start an activity using an intent (explicit or implicit).
I should know the data and the actions the installed applications react on and I should add these information to an intent instance before starting it. I wish LauncherApplication allows the user (not the developer) to configure this intent, but how do I know in advance the parameters to put in an intent for the installed applications?
I should implement the "LauncherApplication* in order to allow the user to construct an intent via a graphical interface. Or I could make my application supports the addition of plugins: in this way, I could create a plugin for each installed application, where each plugin could be responsible to manage the configuration of the intent concerning the application associated with it.
UPDATE (added details). In particular, the LauncherApplication should be a service with a speech recognizer enabled, so the user may start an application uttering specific keywords: as well as launch an application, the user should be able to close it and use its functions.
For example, I could have installed an application ((Let's call it LibraryApp) to search for available books in a library; this application could have the following functions:
Search for a book (this function may return if the book is available, it has already been loaned or if it was booked by someone else).
Reserving a book (this function should return the completion of the reservation).
In this way, when I pronounce, for example, the words "start LibraryApp", then the LauncherApplication service should launch the LibraryApp application. Once the application is launched, the service should be able to send commands to it to use one of the available functions (search for a book, reserving a book).
How can I send commands to application that is already active, in order to control it?
how do I know in advance the parameters to put in an intent for the installed applications?
You talk to their developers. There are typically zero "parameters" on an Intent to launch the launcher activity (or activities) of an application, since home screens do not put such "parameters" on the Intent.

android - is it possible to use private intents instead of global ones?

background:
i've noticed that for regular activities within, it is possible for any application to open the activities of my app .
question:
is it possible to allow only my own app (or apps , or package) to send and receive intents inside the same scope , so that other application won't be able to receive them or interfere with the flow of the app?
example:
suppose i have a broadcastReceiver that listens to some kind of intent , but this intent is only meant to be used by another service/activity that resides either inside my app , or inside another app that i've created , but i don't want others to be able to use this intent.
please help me.
setPackage()
Set an explicit application package name that limits the components this Intent will resolve to. If left to the default value of null, all components in all applications will considered. If non-null, the Intent can only match the components in the given application package.
or you can use setSelector() , but not both.
suppose i have a broadcastReceiver that listens to some kind of intent , but this intent is only meant to be used by another service/activity that resides either inside my app , or inside another app that i've created , but i don't want others to be able to use this intent.
In addition to Reno's fine answer, for your specific requirement quoted above, use LocalBroadcastManager. Not only do you get the security you seek, but it is more efficient. LocalBroadcastManager is available in the Android Support package and AFAIK should work going back to Android 1.6. Here is a sample project using LocalBroadcastManager.

Intent resolution in Android

If I want to create custom address book (which overrides my phone's default address book), and if I want it to be used by all applications, what should be my intent-filter? Does Android allow me to do such a thing considering the fact that such a third-party app could potentially be malicious?!
And, if I want to have yet another address book application, I suppose the second app also has same intent-filter, isn't it? How does the framework decide which app to pick if I click on Contacts button when making a call? In other words, how does the framework resolve intents in case,there is a conflict between multiple intent-filters?
You can replace any application on Android platform, even Home. Android documentation explains everything there is to know about Intents and Intent Filters and there is a section called Intent Resolution that answers your question. Intent Resolution section for Intent class has some additional information.
As far as I can tell Android doesn't try to resolve a conflict. It ask the user which application to run and gives them the choice to mark this Activity as the default for this Intent. They give an example about mail app here.
While Mr. Smiljanić is basically correct, there is no Contacts application in Android for you to replace. There is Dialtacts, which is the application supporting the contacts, call log, and dialer. That application cannot be replaced, mostly because the dialer cannot be replaced.
So, while you may be able to override some intent filters and get control on some contacts-related requests, you will be unable to get the contacts portion of Dialtacts overridden, which will confuse users.

Categories

Resources