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