Encode
com.google.zxing.client.android.ENCODE
Encode to barcode and display on screen.
Extra ENCODE_TYPE can be one of the following and defines more extras:
“TEXT_TYPE”: Plain text. Use Intent.putExtra(DATA, string). This can be used for URLs too, but string must include “http://” or “https://”.
“EMAIL_TYPE”: An email type. Use Intent.putExtra(DATA, string) where string is the email address.
“PHONE_TYPE”: Use Intent.putExtra(DATA, string) where string is the phone number to call.
“SMS_TYPE”: An SMS type. Use Intent.putExtra(DATA, string) where string is the number to SMS.
“CONTACT_TYPE”: A contact. Send a request to encode it as follows:
import android.provider.Contacts;
Intent intent = new Intent(Intents.Encode.ACTION);
intent.putExtra(Intents.Encode.TYPE, CONTACT);
Bundle bundle = new Bundle();
bundle.putString(Contacts.Intents.Insert.NAME, "Jenny");
bundle.putString(Contacts.Intents.Insert.PHONE, "8675309");
bundle.putString(Contacts.Intents.Insert.EMAIL, "jenny@the80s.com");
intent.putExtra(Intents.Encode.DATA, bundle);
“LOCATION_TYPE”: A geographic location. Use as follows:
Bundle bundle = new Bundle();
bundle.putFloat("LAT", latitude);
bundle.putFloat("LONG", longitude);
intent.putExtra(Intents.Encode.DATA, bundle);
See XZing on github
Use
public void startEncode(String dataString, String type) { Intent intent = new Intent("com.google.zxing.client.android.ENCODE"); intent.putExtra("ENCODE_DATA", dataString); // String intent.putExtra("ENCODE_TYPE", type); // String if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } }
Example intent filter
<activity ...> <intent-filter> <action android:name="com.google.zxing.client.android.ENCODE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
Apps Providing an Implementation
Search on Google Play, AppBrain, Amazon App store or similar (not yet available - please make this happen!)
For Specification Writers
Edit on Github