Android 安卓手机
我有两个问题Android 安卓手机,android,wear-os,android-wear-notification,Android,Wear Os,Android Wear Notification,我有两个问题 我们可以通过Android wear应用程序编程打电话吗 我已经在Android上创建了一个wear应用程序。当用户点击自定义通知上的操作时,是否可以打开移动拨号程序应用程序 任何帮助都将不胜感激 谢谢。是的,我想这是可能的。尝试使用: yes thing it is possible. try to use: /*start a direct call, make sure you have call permission declared on your manifest *
谢谢。是的,我想这是可能的。尝试使用:
yes thing it is possible. try to use:
/*start a direct call, make sure you have call permission declared on your manifest
*<uses-permission android:name="android.permission.CALL_PHONE" />
*/
public static void phoneCall(String n, Activity currentActivity) {
char ench[] = n.toCharArray();
String tel = "";
for (int i = 0; i < ench.length; i++) {
if (ench[i] == '#')
tel = tel + Uri.encode("#");
else
tel = tel + ench[i];
}
String toDial = "tel:" + tel;// msgbox(Intent.ACTION_ALL_APPS);
currentActivity.startActivityForResult(
new Intent(hasPermission(currentActivity,
permission.CALL_PHONE) ? Intent.ACTION_CALL
: Intent.ACTION_DIAL, Uri.parse(toDial)), 1024);
}
//open phonne compositor with phone number as n
public static void phoneDial(String n, Activity currentActivity) {
char ench[] = n.toCharArray();
String tel = "";
for (int i = 0; i < ench.length; i++) {
if (ench[i] == '#')
tel = tel + Uri.encode("#");
else
tel = tel + ench[i];
}
String toDial = "tel:" + tel;// msgbox(Intent.ACTION_ALL_APPS);
Intent intent=new Intent(Intent.ACTION_DIAL,
Uri.parse(toDial));
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
currentActivity.startActivityForResult(intent, 1024);
}
//control if your application have some permission
public static boolean hasPermission(Context context, String permission) {
int res = context.checkCallingOrSelfPermission(permission);
return (res == PackageManager.PERMISSION_GRANTED);
}
是的,这是可能的。尝试使用:
/*启动直接调用,确保在清单上声明了调用权限
*
*/
公共静态void phoneCall(字符串n,活动currentActivity){
char ench[]=n.toCharArray();
字符串tel=”“;
对于(int i=0;i
我对此也很感兴趣。你知道这是否可行吗?