2 * Copyright (C) 2008 ZXing authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing.client.android;
19 import android.provider.Contacts;
21 public final class Contents {
27 * All the formats we know about.
29 public static final class Format {
30 public static final String UPC_A = "UPC_A";
31 public static final String UPC_E = "UPC_E";
32 public static final String EAN_8 = "EAN_8";
33 public static final String EAN_13 = "EAN_13";
34 public static final String CODE_39 = "CODE_39";
35 public static final String CODE_128 = "CODE_128";
36 public static final String QR_CODE = "QR_CODE";
41 public static final class Type {
43 * Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string
44 * must include "http://" or "https://".
46 public static final String TEXT = "TEXT_TYPE";
49 * An email type. Use Intent.putExtra(DATA, string) where string is the email address.
51 public static final String EMAIL = "EMAIL_TYPE";
54 * Use Intent.putExtra(DATA, string) where string is the phone number to call.
56 public static final String PHONE = "PHONE_TYPE";
59 * An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS.
61 public static final String SMS = "SMS_TYPE";
64 * A contact. Send a request to encode it as follows:
66 * import android.provider.Contacts;
68 * Intent intent = new Intent(Intents.Encode.ACTION);
69 * intent.putExtra(Intents.Encode.TYPE, CONTACT);
70 * Bundle bundle = new Bundle();
71 * bundle.putString(Contacts.Intents.Insert.NAME, "Jenny");
72 * bundle.putString(Contacts.Intents.Insert.PHONE, "8675309");
73 * bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com");
74 * bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102");
75 * intent.putExtra(Intents.Encode.DATA, bundle);
77 public static final String CONTACT = "CONTACT_TYPE";
80 * A geographic location. Use as follows:
81 * Bundle bundle = new Bundle();
82 * bundle.putFloat("LAT", latitude);
83 * bundle.putFloat("LONG", longitude);
84 * intent.putExtra(Intents.Encode.DATA, bundle);
86 public static final String LOCATION = "LOCATION_TYPE";
92 // These are new constants in Contacts.Intents.Insert for Android 1.1.
93 // TODO: Remove these constants once we can build against the 1.1 SDK.
94 private static final String SECONDARY_PHONE = "secondary_phone";
95 private static final String TERTIARY_PHONE = "tertiary_phone";
96 private static final String SECONDARY_EMAIL = "secondary_email";
97 private static final String TERTIARY_EMAIL = "tertiary_email";
101 * When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple
102 * phone numbers and addresses.
104 public static final String[] PHONE_KEYS = {
105 Contacts.Intents.Insert.PHONE, SECONDARY_PHONE, TERTIARY_PHONE
108 public static final String[] EMAIL_KEYS = {
109 Contacts.Intents.Insert.EMAIL, SECONDARY_EMAIL, TERTIARY_EMAIL