Android - 입출력
스마트폰 OS인 Android에서 입출력 관련 사항을 정리 한다.
Android 입출력
Android 입출력 개요
안드로이드(Android)의 구성 요소를 프로그램의 가장 기본인 MVC 모델에 맞추어 한번 살펴 보자.
View |
안드로이드에서 View는 화면을 구성하는 가장 기본적인 요소로 View에서 파생된 Layout, Control, Widget, ViewGroup, Menu 등을 사용하여 화면을 구성하고 사용자와 상호작용을 한다. |
Control |
비즈니스 로직을 처리 하는 구성 요소로는 Activity, Service, BroadcastReceiver가 있다. |
Model |
데이터 관리를 위한 구성 요소로는 SQLite, ContentProvider가 있고 그외에 여러가지 형태의 데이터를 관리 한다. 안드로이드는 다양한 센서를 내장하고 있는데 센서를 통한 데이터 관리도 가능 하다. |
여기서는 Model에 해당하는 것을 조금 더 살펴 보자. 안드로이드 앱은 Android Package 형태로 패키징 되어 스마트폰에 배포된다. Android Package를 기준으로 Model을 살펴 보자. Android Package는 Linux 기반에서 동작을 하므로 Package는 소유자의 권한으로 실행이 되며 Package별로 Context를 가지고 있다. Context는 Activity, Service, BroadcastReceiver 등의 상위 클래스로 Context를 통해 Package에 속한 자원에 접근할 수 있다. (Package : Context, 소유자)
Package 내부 |
Package 내부의 자원은 Package에서만 접속이 가능하며, 다른 Package에서 접근하려면 패키지 사용자를 동일하게 맞추거나 Context를 통해서만 접속이 가능하다.
|
Package 외부 |
Package 외부의 자원은 여러 Package가 공유하여 사용할 수 있는 공용의 자원이다.
|
스마트폰 외부 |
Smart Phone 외부의 자원에 접속하기 위해서는 Network를 통해 접속 한다. 네트워크로는 3G, Wi-Fi, Bluetooth 등이 있다. |
Application내 정보 교환
Application에 포함된 Activity, Service, BroadcastReceiver간 아래와 같은 방법으로 정보를 교환할 수 있다.
Static class |
public class MessagesSQLiteOpenHelper extends SQLiteOpenHelper { public static final String MESSAGE_ID = "id"; } import static com.jopenbusiness.android.messages.MessagesSQLiteOpenHelper.MESSAGE_ID; //--- 프로그램에서 MESSAGE_ID를 직접 사용할 수 있다. |
Context |
|
Application |
Activity와 Service는 자신이 포함된 Application에 접근할 수 있다. Application을 사용하여 Activity와 Service간 정보를 교환해 보자.
public class SmartAndroidApplication extends Application { //--- Activity, Service에서 같이 사용할 함수를 정의 한다. }
<application android:icon="@drawable/icon" android:name=".SmartAndroidApplication" android:label="@string/app_name"> </application>
SmartAndroidApplication app = (SmartAndroidApplication)getApplication(); boolean rtcd = app.checkLogin(strUserid, strPassword); |
Intent의 Extras (Bundle) |
//--- Intnet에 정보를 저장 한다. Intent intent = new Intent(getApplicationContext(), MessageActivity.class); intent .putExtra("name", "value"); startActivity(intent); //--- Intent에 저장된 정보를 가져 온다. Intent intent = getIntent(); String value = data.getStringExtra("name"); |
Resource 입출력
- Context를 통한 SharedPreferences XML 파일 접근
- /data/data/$PACKAGE_HOME/shared_prefs/~.xml
- Linux (Android)에 파일로 저장되므로 접근 권한을 가짐
- SharedPreferences 사용
//--- accessMode : Linux에서 파일의 Other 권한 설정 //--- Context.MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE SharedPreferences pref = getSharedPreferences(String filename, int accessMode); pref.getString(name, default); //--- SharedPreferences에 lock을 설정 한다. Editor prefEditor = pref.edit(); //--- value type : String, boolean, float, int, long prefEditor.putString(name, value); //--- SharedPreferences에 unlock을 설정 한다. prefEditor.commit();
- 다른 애플리케이션의 SharedPreferences 사용
Context context = createPackageContext("com.msi.prefs", int accessMode); context.getSharedPreferences(String filename, int accessMode);
File 입출력
- File 입출력
- /data/data/$PACKAGE_HOME/files/fileName
byte[] buf = new byte[1024 + 1]; FileInputStream finp = OpenFileInput(filename); FileOutputStream fout = OpenFileOutput(filename, Context.MODE_PRIVATE); while (finp.read(buf) != -1) { new String(buf); } finp.close(); fout.write(String.getBytes()); fout.flush(); fout.close();
- 동일 사용자 아이디로 파일 공유
- AndroidManifest.xml 파일에서 android:sharedUserId = "sameUser";
SD 입출력
- SD (Secure Digital) 플래시 메모리 카드 입출력
- 파일 위치 : /sdcard
- Tools : mksdcard
- FAT (File Allocation Table) 파일 시스템
File file = new File("/sdcard/~"); FileOutputStream fout = new FileOutputStream(file);
- 권한 설정
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
SQLite 입출력
- SQLite (sqlite3)
- 동일 패키지 내에서만 접근 가능
- /data/data/$PACKAGE_HOME/databases/dbname.db
- public abstract class android.database.sqlite.SQLiteOpenHelper
- SQLiteOpenHelper -> SQLiteDatabases
- Cursor : 조회
- ContentValues : 등록, 수정
- : 삭제
SQLiteOpenHelper helper = new SQLiteOpenHelper(Context, dbName, null, version(=3)); //--- SQLiteDatabase getWritableDatabase(), getReadableDatabase() android.database.sqlite.SQLiteDatabase db = helper.getWritableDatabase(); android.database.Cursor cur = null; ContentValues values = new ContentValues(); String[] COLS = new String[] {"_id", "zip"}; db.beginTransaction(); //--- execSQL(String sql) //--- execSQL(String sql, Object bindArgs[]) db.execSQL(~); values.put(name, value); db.insert(dbTable, null, values); db.update(dbTable, values, 조건, 조건_변수s); db.delete(dbTable, 조건, 조건_변수s); db.endTransaction(); //--- Cursor query(boolean distinct, String table, String columns[], String selection, //--- String selectionArgs[], String groupBy, String having, String orderBy, String limit) //--- Cursor rawQuery(String sql, String selectionArgs[]) cur = db.query(true, dbTable, COLS, 조건, null, null, null, null); cur.moveToFirst(); for (int i = 0;i < cur.getCount();i++) { cur.getLong(0), cur.getString(1), cur.getInt(2) cur.moveToNext(); } if ((cur != null) && (!cur.isClosed())) { cur.close(); }
- selection
=?, !=? LIKE '%?%', IN (a, b, c) AND, OR, NOT
- sqlite3 Tools
cd $ANDROID_HOME/tools adb shell sqlite3 /data/data/$PACKAGE_HOME/databases/~.db
- 참고 문헌
ContentProvider 입출력
- 서로 다른 애플리케이션 사이에서 데이터 공유
- ContentProvider의 URI 예
- content://contacts/people
- content://contacts/people/?
- ContentProvider 가져오기
android.content.ContentResolver resolver = android.content.Context.getContentResolver(); InputStream openInputStream(Uri uri) OutputStream openOutputStream(Uri uri) OutputStream openOutputStream(Uri uri, String mode) Uri resolver.insert(Uri url, ContentValues values) int resolver.update(Uri uri, ContentValues values, String where, String selectionArgs[]) int resolver.delete(Uri url, String where, String selectionArgs[]) //--- Cursor query(Uri uri, String projection[], //--- String selection, String selectionArgs[], String sortOrder) Cursor cur = resolver.query(URI, COLS, null, null, sort); //--- Cursor의 Lifecycle이 Activity에 의해서 관리됨 Cursor Activity.managedQuery(Uri uri, String projection[], String selection, String selectionArgs[], String sortOrder)
- 확인이 필요한 사항
- Android 내장 ContentProvider의 종류와 사용법
- 참조
Network 입출력
- Mobile IP Network 입출력
- WiFi, 3G
- AndroidManifest.xml에 권한 설정
<uses-permission android:name="android.permission.INTERNET"/>
- Network 상태 확인
android.net.ConnectivityManager cMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); android.net.NetworkInfo netInfo = cMgr.getActiveNetworkInfo(); //--- CONNECTED, CONNECTING, DISCONNECTED, DISCONNECTING, SUSPENDED, UNKNOWN netInfo.getState() netInfo.isConnected(), isAvailable()
- Socket
java.net.ServerSocket server = new ServerSocket(PORT, 1); while (true) { Socket client = server.accept(); while (true) { BufferedReader reader = new BufferedReader( new InputStreamReader(client.getInputStream())); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(client.getOutputStream())); String textLine = reader.readLine(); writer.write(textLine, 0, textLine.length()); writer.flush(); } client.close(); } java.net.Socket socket = new Socket(ip, port); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())); BufferedReader reader = new BufferedReader( new InputStreamReader(socket.getInputStream()));
- HttpURLConnection
URL url = null; HttpURLConnection conn = null; PrintWriter postReq = null; BufferedReader postRes = null; StringBuffer buf = null; StringBuilder html = null; String line = null; html = new StringBuilder(); try { url = new URL("http://smartycontact.appspot.com/json/smartyContact/contact/listJSONDaou.do"); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setUseCaches(false); conn.setDoOutput(true); conn.setDoInput(true); //conn.setRequestProperty("content-type", "application/x-www-form-urlencoded"); buf = new StringBuffer(); buf.append("cloudName=" + cloudName); buf.append("&email=" + email); buf.append("&password=" + password); postReq = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8")); postReq.write(buf.toString()); postReq.flush(); postRes = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); while ((line = postRes.readLine()) != null){ html.append(line); } conn.disconnect(); } catch (MalformedURLException e2) { e2.printStackTrace(); } catch (IOException e2) { e2.printStackTrace(); } return html.toString();
- HttpClient
org.apache.http.client.ResponseHandler<String> handler = new ResponseHandler<String>() { public String handleResponse(org.apache.http.HttpResponse response) { StatusLine status = response.getStatusLine(); HttpEntity entity = response.getEntity(); String result = StringUtils.inputStreamToString(entity.getContent()); return result; } } DefaultHttpClient client = new DefaultHttpClient(); client.addRequestInterceptor( new HttpRequestInterceptor() { public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { request.addHeader(key, value); } } ); client.getCredentialsProvider().setCredentials( AuthScope.ANY, new UsernamePasswordCredentials(user, pass)); HttpGet method = new HttpGet(url); client.execute(method , handler); //--- MIME : application/x-www-form-urlencoded, text/html, text/plain HttpPost method = new HttpPost(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair(key, value)); method.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); client.execute(method , handler);
- 웹서비스
- POX (Plain Old XML over HTTP)
- REST
- POST : create, update, delete
- GET : read
- PUT : create, replace
- DELETE : delete
- SOAP
SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); xr.setContentHandler(handler); xr.parse(new InputSource(new StringReader(xmlString)));
내장 ContentProvider 입출력
- 참고 문헌
주소록 입출력
- Android의 주소록 구조
- import android.provider.ContactsContract.Contacts : 최상위 주소록
- import android.provider.ContactsContract.RawContacts : 주소록의 출처별 주소록
- import android.provider.ContactsContract.Data : 주소록에 포함되어 있는 데이터 (예, 전화번호, 이메일 등)
- 주소록 입출력 권한 (AndroidManifest.xml)
<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" />
- Contacts 조회 (Android 2.2)
StringBuffer buf = null; Cursor contacts = null; long contactID = 0l; buf = new StringBuffer(); // String sortOrder = Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; // Cursor contactCursor = managedQuery(uri, projection, selection, selectionArgs, sortOrder); contacts = getContentResolver().query(Contacts.CONTENT_URI, new String[] { Contacts._ID, Contacts.CONTACT_PRESENCE, Contacts.CONTACT_STATUS, Contacts.CONTACT_STATUS_ICON, Contacts.CONTACT_STATUS_LABEL, Contacts.CONTACT_STATUS_RES_PACKAGE, Contacts.CONTACT_STATUS_TIMESTAMP, Contacts.CUSTOM_RINGTONE, Contacts.DISPLAY_NAME, Contacts.HAS_PHONE_NUMBER, Contacts.IN_VISIBLE_GROUP, Contacts.LAST_TIME_CONTACTED, Contacts.LOOKUP_KEY, Contacts.PHOTO_ID, Contacts.SEND_TO_VOICEMAIL, Contacts.STARRED, Contacts.TIMES_CONTACTED }, null, null, null); contacts.moveToFirst(); if (!contacts.isAfterLast()) { do { contactID = contacts.getLong(0); buf.append("--- Contacts Lists ---\n"); for (int idx = 0;idx < contacts.getColumnCount();idx++) { if (contacts.getString(idx) != null) { buf.append(contacts.getColumnName(idx).toUpperCase() + ": " + contacts.getString(idx) + "\n"); } } buf.append("\n"); } while (contacts.moveToNext()); } contacts.close(); return buf.toString();
- RawContacts 조회 (Android 2.2)
StringBuffer buf = null; Cursor rawContacts = null; long rawContactID = 0l; buf = new StringBuffer(); rawContacts = getContentResolver().query(RawContacts.CONTENT_URI, new String[] { RawContacts._ID, RawContacts.ACCOUNT_NAME, RawContacts.ACCOUNT_TYPE, RawContacts.AGGREGATION_MODE, RawContacts.CONTACT_ID, RawContacts.CUSTOM_RINGTONE, RawContacts.DELETED, RawContacts.DIRTY, RawContacts.LAST_TIME_CONTACTED, RawContacts.SEND_TO_VOICEMAIL, RawContacts.SOURCE_ID, RawContacts.STARRED, RawContacts.SYNC1, RawContacts.SYNC2, RawContacts.SYNC3, RawContacts.SYNC4, RawContacts.TIMES_CONTACTED, RawContacts.VERSION }, RawContacts.CONTACT_ID + "=?", new String[] {String.valueOf(contactID)}, null); rawContacts.moveToFirst(); if (!rawContacts.isAfterLast()) { do { rawContactID = rawContacts.getLong(0); buf.append("--- RawContacts Lists ---\n"); for (int pos = 0;pos < rawContacts.getColumnCount();pos++) { if (rawContacts.getString(pos) != null) { buf.append(rawContacts.getColumnName(pos).toUpperCase() + ": " + rawContacts.getString(pos) + "\n"); } } buf.append("\n"); } while (rawContacts.moveToNext()); } rawContacts.close(); return buf.toString();
- Data 조회 (Android 2.2)
StringBuffer buf = null; Cursor contactData = null; buf = new StringBuffer(); contactData = getContentResolver().query(Data.CONTENT_URI, new String[] { Data._ID, Data.MIMETYPE, Data.RAW_CONTACT_ID, Data.IS_PRIMARY, Data.IS_SUPER_PRIMARY, Data.DATA_VERSION, Data.DATA1, Data.DATA2, Data.DATA3, Data.DATA4, Data.DATA5 }, Data.RAW_CONTACT_ID + "=?", new String[] {String.valueOf(rawContactID)}, null); buf.append("--- Data Lists ---\n"); contactData.moveToFirst(); if (!contactData.isAfterLast()) { do { for (int idx = 0;idx < contactData.getColumnCount();idx++) { if (contactData.getString(idx) != null) { buf.append(contactData.getColumnName(idx).toUpperCase() + ": " + contactData.getString(idx) + "\n"); } } buf.append("\n"); } while (contactData.moveToNext()); } contactData.close(); return buf.toString();
- 전화번호 가져오기
import ContactsContract.CommonDataKinds.Phone; Cursor PhoneNumberCursor = getContentResolver().query(Phone.CONTENT_URI, null, null, null, null);
- 연락처 등록
ContentValues values = new ContentValues(); values.put(RawContacts.ACCOUNT_TYPE, "basic"); values.put(RawContacts.ACCOUNT_NAME, "test"); Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri);
- 연락처 수정
int resolver.update(Uri uri, ContentValues values, String where, String selectionArgs[])
- 연락처 삭제
int resolver.delete(Uri url, String where, String selectionArgs[])
- 자신의 번호를 조회
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String myNumber = mTelephonyMgr.getLine1Number();
- 참고 문헌
Android 센서 입출력
Telephony 입출력
- TelephonyManager
- android.telephony.TelephonyManager
android.telephony.TelephonyManager telMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); //--- PHONE_TYPE_NONE, PHONE_TYPE_GSM, PHONE_TYPE_CDMA int phoneType = telMgr.getPhoneType(); //--- SIM_STATE_UNKNOWN, SIM_STATE_ABSENT, SIM_STATE_PIN_REQUIRED //--- SIM_STATE_PUK_REQUIRED, SIM_STATE_NETWORK_LOCKED, SIM_STATE_READY int simState = telMgr.getSimState(); //--- CALL_STATE_IDLE, CALL_STATE_RINGING, CALL_STATE_OFFHOOK int callState = telMgr.getCallState(); String line1Number = telMgr.getLine1Number(); GsmCellLocation cellLocation = (GsmCellLocation) telMgr.getCellLocation();
- PhoneStateListener
PhoneStateListener listener = new PhoneStateListener() { public void onCallStateChanged(int state, String incomingNumber) { } } telMgr.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
- 전화 걸고 받기
- Permission
- android.Manifest.permission
- 참조: http://developer.android.com/reference/android/Manifest.permission.html
전화 걸기 : CALL_PHONE = "android.permission.CALL_PHONE" 긴급 통화 : CALL_PRIVILEGED = "android.permission.CALL_PRIVILEGED" 폰 상태 읽기 : READ_PHONE_STATE = "android.permission.READ_PHONE_STATE" 폰 상태 수정 : MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE" 브로드케스팅 수신 : PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS" 전화 걸기 이전 : ACTION_NEW_OUTGOING_CALL = "android.intent.action.NEW_OUTGOING_CALL"
- 권한 설정 예: <uses-permission android:name="android.permission.CALL_PHONE" />
- ACTION_DIAL
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + TelNumber)); startActivity(intent);
- ACTION_CALL
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + TelNumber)); startActivity(intent);
- Utility
- android.telephony.PhoneNumberUtils
- SMS/MMS 보내고 받기
- android.Manifest.permission
수신 모니터링 : RECEIVE_SMS = "android.permission.RECEIVE_SMS" 읽기 가능 : READ_SMS = "android.permission.READ_SMS" 발송 가능 : SEND_SMS = "android.permission.SEND_SMS" SMS Provider로 전송 : WRITE_SMS = "android.permission.WRITE_SMS" BROADCAST_SMS = "android.permission.BROADCAST_SMS"
- SMS 메시지 보내기
android.telephony.SmsManager sms = SmsManager.getDefault(); PendingIntent sentIntent = PendingIntent.getActivity(this, 0, new Intent(SmsSendCheck), 0); if (PhoneNumberUtils.isWellFormedSmsAddress(dest)) { //--- sendTextMessage(String destinationAddress, String scAddress, //--- String text, PendingIntent sentIntent, PendingIntent deliveryIntent) //--- sendMultipartTextMessage(String destinationAddress, String scAddress, //--- ArrayList parts, ArrayList sentIntents, ArrayList deliveryIntents) sms.sendTextMessage(dest, null, dest, sentIntent, null); }
- SMS 메시지 받기
public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); Object[] pdus = (Object[]) bundle.get("pdus"); for (Object pdu : pdus) { android.telephony.SmsMessage smsMessage = SmsMessage.createFromPdu((byte[])pdu); smsMessage.getDisplayMessageBody(); } }
- 관련 용어
- GSM (Global System for Mobile communications)
- SIM (Subscriber Identity Module)
SMS 입출력
- SMS 발송 화면 표시
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + contact.getHandphone())); // intent.putExtra("sms_body", "The SMS text"); // intent.setType("vnd.android-dir/mms-sms"); startActivity(intent);
- 참고 문헌
Email 입출력
- 이메일 발송 화면 표시
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + contact.getEmail())); startActivity(intent);
Location 입출력
- 위치 정보 저장 및 전송을 위한 포맷
- GPX (The GPS Exchange Format)
- 중간 지점, 트랙, 경로 등을 저장할 수 있는 XML Schema
- http://www.topografix.com/GPX/1/1/
- KML (Keyhole Markup Language)
- LocationProvider 종류
- Network, 기지국을 활용한 삼각측량법, GPS
- LocationProvider 제공 정보
- 위도와 경도, 속도, 방위 및 고도
- android.location.LocationManager
- Permission : android.Manifest.permission
GPS Provider : ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION" Network Provider : ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION" LocationManager locManager= (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); //--- GPS_PROVIDER, NETWORK_PROVIDER LocationProvider locProvider = (LocationProvider) locManager.getProvider(LocationManager.GPS_PROVIDER); Location loc = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); //--- lat. 위도, log. 경도 int lat = (int) (loc.getLatitude() * LocationHelper.MILLION); int lon = (int) (loc.getLongitude() * LocationHelper.MILLION); LocationListener locListener = new LocationListener() { public void onLocationChanged(final Location loc) { } } locManager.requestLocationUpdates(locProvider.getName(), 3000, 185000, locListener);
- 지정한 위도와 경도의 지도를 표시
new Intent(Intent.ACTION_DIAL, Uri.parse("geo:<latitude>,<longitude>"));
NFC
- NFC : Near Field Communication
- 모바일 RFID 서비스의 하나로, 13.56MHz 주파수 대역을 사용하는 비접촉식 근거리 무선통신방식
- 10cm 이내의 좁은 거리에서 424Kbps 속도로 양방향 읽기/쓰기가 가능, 암호화 기술 적용 가능
- 배터리없는 수동모드를 지원하여 유지비용이 들지 않음
- 단말기간 상호 인식 시간이 1/10초로 짧음
- 인식거리는 짧지만 보안성이 뛰어나 NFC를 이용한 모바일결제가 본격적으로 개화할 것이라는 전망
- NFC 시장 전망
- Visiongain 전망 : NFC 지원 단말기 수가 2010년 4,100만대에서 2015년 8억 1,700만대로 급성장
- Gartner 전망 : NFC기반 결제건수가 2010년 3억 1,6000만 건에서 2015년 35억 7,200만 건으로 11배 이상 증가
Bluetooth
Camera
- 카메라 띄우기
Intent intent = null; intent = new Intent(Intent.ACTION_MAIN); intent.setCompont(new CompontName("com.android.camera", "com.android.camera.Camera")); startActivity(intent);
- 앨범에서 사진을 반환
intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); StartActivityForResult(intent, REQ_IMAGE_SELECT); -> onActivityResult(~) { URI img = data.getData(); }
- 카메라로 사진을 찍어 반환
intent = new Intent(Mediastore.ACTION_IMAGE_CAPTURE); intent.setType("image/*"); StartActivityForResult(intent, REQ_CAMERA_SELECT); -> onActivityResult(~) { URI img = data.getData(); }
compass
- 나침판
accelerometer
- 가속도 센서
이미지
비디오
오디오
VoIP
mVoIP
- 음성 통화
- Skype
- 정액요금제에 가입할 경우 37개 국가에서 1분에 25원대의 요금으로 국제전화와 휴대폰 등을 이용
- 서비스 회원들끼리는 음성채팅 개념으로 3G와 와이파이를 이용한 무료 전화
- Google Voice
- Viber (for iPhone)
- 수다폰 (에스비인터랙티브, for iPhone)
- 영상 통화
- 페이스타임
- Tango Video Call