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;
22 * The set of constants to use when sending Barcode Scanner an Intent which requests a barcode
25 * @author dswitkin@google.com (Daniel Switkin)
27 public final class Contents {
31 public static final class Type {
33 * Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string
34 * must include "http://" or "https://".
36 public static final String TEXT = "TEXT_TYPE";
39 * An email type. Use Intent.putExtra(DATA, string) where string is the email address.
41 public static final String EMAIL = "EMAIL_TYPE";
44 * Use Intent.putExtra(DATA, string) where string is the phone number to call.
46 public static final String PHONE = "PHONE_TYPE";
49 * An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS.
51 public static final String SMS = "SMS_TYPE";
54 * A contact. Send a request to encode it as follows:
56 * import android.provider.Contacts;
58 * Intent intent = new Intent(Intents.Encode.ACTION);
59 * intent.putExtra(Intents.Encode.TYPE, CONTACT);
60 * Bundle bundle = new Bundle();
61 * bundle.putString(Contacts.Intents.Insert.NAME, "Jenny");
62 * bundle.putString(Contacts.Intents.Insert.PHONE, "8675309");
63 * bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com");
64 * bundle.putString(Contacts.Intents.Insert.POSTAL, "123 Fake St. San Francisco, CA 94102");
65 * intent.putExtra(Intents.Encode.DATA, bundle);
67 public static final String CONTACT = "CONTACT_TYPE";
70 * A geographic location. Use as follows:
71 * Bundle bundle = new Bundle();
72 * bundle.putFloat("LAT", latitude);
73 * bundle.putFloat("LONG", longitude);
74 * intent.putExtra(Intents.Encode.DATA, bundle);
76 public static final String LOCATION = "LOCATION_TYPE";
83 * When using Type.CONTACT, these arrays provide the keys for adding or retrieving multiple
84 * phone numbers and addresses.
86 public static final String[] PHONE_KEYS = {
87 Contacts.Intents.Insert.PHONE,
88 Contacts.Intents.Insert.SECONDARY_PHONE,
89 Contacts.Intents.Insert.TERTIARY_PHONE
92 public static final String[] EMAIL_KEYS = {
93 Contacts.Intents.Insert.EMAIL,
94 Contacts.Intents.Insert.SECONDARY_EMAIL,
95 Contacts.Intents.Insert.TERTIARY_EMAIL