티스토리 뷰

Mobile/Android

[Android] SMS,MMS,Call Check

out of coding 2016. 8. 1. 16:54

/**

 * SMS

 */

public static boolean aviliableSMS(Context context) {

 

PackageManager pac = context.getPackageManager();


Uri smsUri = Uri.parse("sms:"); 

Intent smsIntent = new Intent(Intent.ACTION_SENDTO, smsUri);


List<resolveinfo> list = pac.queryIntentActivities

(smsIntent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);    

ArrayList<activityinfo> tempList = new ArrayList<activityinfo>();

 

int count = list.size();

String packageName = "";

 

for(int i = 0; i < count; i++)  

{

ResolveInfo firstInfo = list.get(i);

packageName = firstInfo.activityInfo.applicationInfo.packageName;

tempList.add(list.get(i).activityInfo);

}

 

if(packageName == null || packageName.equals("")){

return false;

}else{

return true;

}

}

 

 

/**

 * MMS

 */

public static boolean aviliableMMS(Context context) {

 

PackageManager pac = context.getPackageManager();


Uri mmsUri = Uri.parse("mmsto:");

Intent mmsIntent = new Intent(Intent.ACTION_VIEW, mmsUri); 


List<resolveinfo> list = pac.queryIntentActivities

(mmsIntent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);    

ArrayList<activityinfo> tempList = new ArrayList<activityinfo>();

 

int count = list.size();

String packageName = "";

 

for(int i = 0; i < count; i++)  

{

ResolveInfo firstInfo = list.get(i);

packageName = firstInfo.activityInfo.applicationInfo.packageName;

tempList.add(list.get(i).activityInfo);

}

 

if(packageName == null || packageName.equals("")){

return false;

}else{

return true;

}

}

 

 

/**

 * CALL

 */

public static boolean aviliableCALL(Context context) {

 

PackageManager pac = context.getPackageManager();


Uri callUri = Uri.parse("tel:");

Intent callIntent = new Intent(Intent.ACTION_CALL, callUri);


List<resolveinfo> list = pac.queryIntentActivities

(callIntent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);   

ArrayList<activityinfo> tempList = new ArrayList<activityinfo>();

 

int count = list.size();

String packageName = "";

 

for(int i = 0; i < count; i++)  

{

ResolveInfo firstInfo = list.get(i);

packageName = firstInfo.activityInfo.applicationInfo.packageName;

tempList.add(list.get(i).activityInfo);

}

 

if(packageName == null || packageName.equals("")){

return false;

}else{

return true;

}

}

'Mobile > Android' 카테고리의 다른 글

[Android] 설정 화면 띄우기  (0) 2016.08.02
[Android] AccessibilityService  (0) 2016.08.02
[Android] Focus  (0) 2016.08.01
[Android] Account 정보 가져오기  (0) 2016.07.27
[Android] webview ssl 인증 오류  (1) 2016.07.26
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함