I would like to extend the Android platform's default Gmail/Email applications either by plugging into their ContentProvider or by using intent filters. Essentially, I want to be able to scan incoming emails for special rules that will trigger events in my Android application. If scanning emails automatically isn't possible, then I would at least like to add a menu item to the email viewer screen that would allow the user to flag the email content as needing to be scanned.
Does the Gmail/Email applications allow you to extend them in this way?
For future reference, besides finding sample code or reading documentation provided by the author of an application, is there a standard way of finding out what intents are available for my application to use? Like a tool maybe?
Thanks,
Marc
Does the Gmail/Email applications allow you to extend them in this way?
Gmail is closed source, and so it is difficult to know what it does or does not support.
The Email application is not part of the public SDK, so trying to rely upon any ContentProvider it may have (and I don't know that it has one) would be a mistake, as your application is liable to break with subsequent Android updates.
I would at least like to add a menu item to the email viewer screen that would allow the user to flag the email content as needing to be scanned.
The only way to do that assumes Gmail/Email uses Menu#addIntentOptions(), and via Google Code Search, this does not appear to be the case.
You might consider contacting the developers of K9 to see if you could hook into their Android email application.
is there a standard way of finding out what intents are available for my application to use? Like a tool maybe?
Not really. Intent actions are just strings.
Related
I have a question about controlling applications in Android. I want to develop an application which selects appropriate network bands for each application. I guess i have to grant superuser access but i have another problem. Is there any available java code to do that?? Is there any library or something that you know? How can i do that?
I can list apps in a listview but i want controll them with an switch. There must be connection with the applications by switch
Thanks...
It' easier then what you think. Check out android intents (here) (and here). Intents are a kind of an event bus provided by android framework that can be used to launch applications as well as activities/services/receivers
In Java we can get the highlighted text from native window by using JNA or JNI. For example we could use
Monitor text that is highlighted
Is there any way to do the same thing by using Android SDK??
You are welcome to use the accessibility APIs to write an accessibility service and watch for text selection events. This will require the user to agree to allow your app to spy on all user input, which will tend to make your app less popular.
Otherwise, this is not possible, for obvious privacy and security reasons.
Using purely the SDK without exploiting a security vulnerability is not possible.
There is a simple explanation of why this is not possible.
The first reason is the way Android apps are executed in the OS in a sandboxed way using linux's user groups and permission system.
Every running process and Application on Android has it's own user and group and permissions to access those resources only. So in a way they cannot communicate with other apps(or capture what a user is highlithing at the moment.
The only way for an app to communicate with other is using the binder IPC, which has to pass through the activity manager first. As far as my knowledge goes, there is not a defined way to do this. Notice this is a layer of protections inherited from linux below Android's usual permission system.
Adding to this, starting from Android 5(lollipop) add to this layer the now enforced selinux policies, which do not allow the application domain to access other domains that handle graphics, the mediaserver, and some others, I will not enter more in this topic due to it's complexity and relevance to the question, just know that these are some very secure mechanisms that prevent actions that might imply a security breach.
Is it possible? Yes, however it involes exploiting a vulnerability, but this is another topic and for that I should recommend to search papers on the web that talk about vulnerabilities in android.
I've worked with Android in the past, but haven't done anything super-advanced or what I'm about to describe so need some guidelines as to what the best approach/method is to do this before I proceed.
I'm not entirely sure how to google this, so it's best to explain.
I want to build an Android library project preferably with the source undisclosed. I read this can be done as follows: Create another jar that the Android library project references. However, not sure if all of the source code can be private. If anyone can point me somewhere, that would be great.
Asides from that, the library needs to expose an API for any Android app to use, and some sort of event mechanism to broadcast an event when certain events happen (e.g when the app is in foreground etc).
A scenario would be:
1) User loads the app which has the library embedded
2) The embedded library detects that the app has loaded and 'sends an event' to the app
3) The app captures the event and does some stuff specific to the app + an API call to the library
I guess what I'm interested mostly is figuring out what the best ways are to capture the callbacks by the app, once the library has sent some event to the app and to reduce the burden on the developer having to spend too much time implementing what needs to be done when certain events are captured.
Hope this makes sense.
I am interested in developing a custom Android launcher which would be installed onto a device primarily for censorship. Ideally a device would divert attempts to launch applications to a service which would decide, based on a profile, whether the user would be allowed to proceed, or be shown a block screen/redirected to an informational web page.
Is it possible to detect and interrupt application launches via some kind of background service or attachable listener? Or alternatively, might it be possible to have a launcher launch a different application than the one clicked on, in order to allow for indirection?
Or, if all of this is impossible, can a service running as part of a custom launcher dynamically hide/unhide launch icons based on triggering events/messages?
There is no way to catch an app being launched and redirect that. If you think about all the horrible things people could do with this it's easy to see why. I think you're going about this in the wrong way. Instead of trying to enforce these rules with a custom launcher you should look into one of the Mobile Device Management options that are available for Android or work on creating your own.
I'm trying to obtain a share dialog similar to the one below for sharing some plain text with a preselected list of apps (email, Facebook, Twitter, Google+). The problem is that if I launch an intent to share text, the dialog has too many apps.
1) Can I explicitly choose the apps shown in the dialog?
2) If not, I can make a custom dialog. If so, can I specifically choose an app to launch and provide it with my intent? for each dialog option, I'd launch a specific app. First item - email, second item - facebook etc.
1) Can I explicitly choose the apps shown in the dialog?
You cannot modify this list that the OS creates with the app chooser. (I'm guessing that all of these apps accept the very common data type "text/plain".)
2) If not, I can make a custom dialog. If so, can I specifically choose an app to launch and provide it with my intent? for each dialog option, I'd launch a specific app. First item - email, second item - facebook etc.
As far as building your own custom list, you need to consider a few points:
You could create Intents that explicitly open the GMail and Facebook apps, but some users don't use these particular apps. Instead you should display apps that accept specific data types (or MIME types).
Email apps have a specific MIME type: "message/rfc822", but some don't use it. You might be safer using "text/plain".
I am unaware of any specific Facebook MIME type, you will have to use "text/plain" anyways. Alternatively, you could use the PackageManager to search every installed appfor the string "facebook", however a third party Facebook app might not have this string in its package name....
If you are going to use the "text/plain" data type then you will end up with the list that the OS already automatically created for you...
What you want to do is not impossible, but it is harder than it sounds. In the end you accidentally might exclude the user's favorite app from your customized list...
(Android has an insightful blog on this subject: Sharing with Intents.)