1
votes

I know that another application accepts intent type: vnd.android.cursor.item/postal-address

I can make it show by calling:

Uri dataUri = Uri.parse("test");
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
 intent.setDataAndType(dataUri, "vnd.android.cursor.item/postal-address");

Question is, how to pass well formated address?

E.g. i I pass Uri dataUri = Uri.parse("content://com.android.contacts/data/2057"); it works, but I want to pass new address (not from Contacts).

UPDATE: This external application has two intent-filters:

intent-filter: action: 'android.intent.action.MAIN' category: 'android.intent.category.DEFAULT' data: mimeType: 'vnd.android.cursor.item/postal-address'

intent-filter: action: 'android.intent.action.MAIN' category: 'android.intent.category.DEFAULT' data: mimeType: 'vnd.android.cursor.item/postal-address_V2' scheme: 'content' host: 'com.android.contacts'

Thank you.

2

2 Answers

2
votes

My observations are the following. This external application in the intent receives the id of the contact. Then it extracts this contact and fetches the postal-address of the contact. Thus, this applications makes a query to contacts content provider and extracts the postal-address by itself. Thus, you should provide this application with the valid url of the contact.

So, I think that this external application requires only url from contacts content provider. You cannot force the application to extract data from other source, unless you don't control this external application.

UPDATE: If you want simply show google maps with this address try smth following:

Uri geoUri = Uri.parse("geo:0,0?q=your_address");
Intent mapCall = new Intent(Intent.ACTION_VIEW, geoUri);  
startActivity(mapCall);
1
votes

You can pass data by creating a Bundle and adding it to the Intent object, then retrieving the Intent and reading the Bundle data in afterwards. Something like this will create a simple Bundle:

Bundle b = new Bundle();
b.putString("address", addressTV.getText().toString()); //can be whatever address string you want
intent.putExtras(b);