티스토리 뷰
/**
* 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
- cocoapods
- Java
- docker
- php
- enum
- git
- go
- MySQL
- rxswift
- tomcat
- SWIFT
- intellij
- Codable
- Python
- Windows
- windows10
- ios
- Linux
- centos8
- Kotlin
- ubuntu
- golang
- android
- Xcode
- war
- github
- nodejs
- Spring
- Gradle
- CentOS
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |