How do you get Android Intent for showing "QuickContact"? - android

I'm working on my first Android application, and am trying to get an Intent for the QuickContact panel. Somewhere I had found mention of the method QuickContact.getQuickContactIntent(...). But when I try to use it, it tells me that it is undefined for the type QuickContact. After googling for several days, I find a bunch of pages using it in code, but nothing about how to use it or what imports are necessary or anything. So how do I use this method? I need to get the Intent used to launch the panel.
I've included the following import in my file:
import android.provider.ContactsContract.QuickContact;
Alternatively, what other method could I use to get a QuickContact intent for passing to something expecting an intent? I am looking to pass the intent back in the cursor for a LiveFolder provider.
I am developing against the Google APIs Level 9, platform number 2.3.1.
Thanks!

Use the widget onUpdate() and onRecieve() events to communicate with the RemoteView like explained here. The documented source of that discussion is here if you want some reading material. I can't begin to assume why you're trying to get the intent, or how you initially created the ContactContract.QuickContact object you're referring to. Little more information might get a few more views, and probably alternate solutions; so if this doesn't help consider posting a bit more info.

Well, the way I got this to work was to instead abandon the idea of using LiveFolders, and write my own "folder" dialog, to which I can add actual QuickContactBadge widgets using an adapter of my own devising.

Related

How to add an element to the pull down notification bar of an existing app?

I want to add a mark as read option to the pull down notification bar of Gmail but I don't have the slightest clue about where to start. If somebody can tell me how to do it or point me in the direction of the right docs to pull it off it would be much appreciated.
I know it is possible because it has already been done, but I want to do it by myself.
That's quite an undertaking.
So the link you provided has a bit of a walkthrough in its description about where to start. The trick is that because you're trying to program a notification service for an EXISTING app, you don't really have control over the notifications the app itself creates. I suspect what you're going to have to do is program a NotificationListenerService, listen for gmail notifications, and somehow cancel the gmail notification and replace it with one of your own, as created through the android documentation.
For a good example of how NotificationListenerService works please take a look at this:
https://github.com/kpbird/NotificationListenerService-Example
The canceling is something I have not tested but you asked for ideas, not code. NotificationListenerService has a method cancelNotification(String pkg, String tag, int id) which looks like you can use to cancel the gmail notification.
You can get access to the raw Notification-object using an AccessibilityService. I haven't tried it before to be honest, but I assume you can modify the Notification and add your own buttons, etc.
More information on tinkering with the Notification-object in an AccessibilityService here: https://stackoverflow.com/a/10303676/198996

Android: intent started, but which parameters to pass?

I want to add support for several navigation applications in my app. I know how to start another activity as intent and pass parameters - but is there any way to check the naming of the parameters I should pass? For example: Navigon should start with routing calculation and instructions immediately after starting from within my application. So far, I'm not even sure Navigon supports parameter passing, but I don't even know how to figure that out.
Thanks in advance!
You should check the documentation for each app you're interested in supporting. They should have it laid out somewhere. If they don't, they might not support explicit intent extras.
For example, Navigon has their options laid out here(found by searching "android navigon intent"):
http://www.navigon.com/portal/common/faq/files/online_documents/NAVIGON_Android_public_Intent.pdf

Android intent opposite of setComponent

I know I can force an intent to use a specific application/activity by using intent.setComponent(). But is there a way to say that it should not use a specific app/activity?
Why I need this:
My application will be able to respond to several urls (like http://www.companyname.com/something/12345). If my app launches cause of an Intent to this url, I'll check if I have the needed data to handle this. (In my example, something with id 12345). If I'm not able to do something useful with the intent, I create a new Intent with the same data, so the user can try to view the content in its browser.
This is the moment my problem occurs. When I start my newly created intent, my app appears again in the list of apps that can handle this. But I already know that my app can't do anything with this intent. The user already knows that my app can't handle the intent, but still it'd be nice if my app just didn't appear in this list.
Thanks in advance.
A possible solution that works is when creating the new intent, instead of intent.setData(uri) I do intent.setDataAndType(uri, "text/html").
This causes that my app disappears from the list. At the moment it's a solution that works :) But still I'd like to know if there are better ways to achieve this result.
You may use Intent-Filters for your app and set up the URI with wildcards as you need, see here for more information. With some additional info via an action or category, you may ensure, that your app it the only one (not) matching against the intent.

Opening a Calculator in Android

I'm looking to open a calculator from within my Activity. Here's my code right now and it works:
Intent i = new Intent();
i.setClassName("com.android.calculator2",
"com.android.calculator2.Calculator");
I would like to make this an implicit call because I don't know what calculator the use would like to use and I would like to leave the option open to receive a value from the calculator, which the android one apparently doesn't do. I haven't been able to find a good example of how to implicitly ask for a type of application.
I've looked at http://www.openintents.org/en/intentstable but I guess I don't completely understand how to use that site.
I think I understand the intent of intents, but maybe I just don't have a firm grasp on how to use them.
What you have is probably the best you can do. I just checked the AndroidManifest.xml for com.android.calculator2.Calculator and it doesn't listen for any other intents.

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

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....

Categories

Resources