问题描述
前段时间我在一个this后,和我的同事和我已经发现了两个不同的答案,它(他们两人的工作):
-
首先解决方案是使用
意图callIntent =新意图(android.intent.action.CALL_PRIVILEGED);
这将打开新的窗口,提供呼叫被大家所制成用于放置呼叫可能的手段 - 在这种特殊情况下,他们是拨号器和Viber的和Skype(或更高版本添加任何其他方式)。
-
第二个解决方案是显式调用Viber的,并把手机号被称为以及
意图viberCallIntent =新的意向书(com.viber.voip.action.CALL);viberCallIntent.setType(vnd.android.cursor.item / vnd.com.viber.voip.call);viberCallIntent.setData(Uri.parse(电话:+ dialNumber));viberCallIntent.putExtra(external_call,真正的);viberCallIntent.putExtra(CONTACT_ID,-1L);startActivity(viberCallIntent);
自去年Viber的更新(昨天我们注意到了这一点),没有这些方法的工作。第一个只是调用使用Skype,甚至没有提供拨号器(!?!),但是如果没有安装Skype,然后它会回落到拨号和拨打电话。第二个崩溃声称没有活动发现处理意图是什么?
任何想法发生什么事,怎么会这样解决?
错误日志如下:
01-27 17:35:03.794:E / AndroidRuntime(7738):致命异常:主要
01-27 17:35:03.794:E / AndroidRuntime(7738):android.content.ActivityNotFoundException:无活动处理意向{行为= com.viber.voip DAT =电话:XXXXXXXXX(有群众演员)}
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.Instrumentation.execStartActivity(Instrumentation.java:1423)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.Activity.startActivityForResult(Activity.java:3388)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.Activity.startActivityForResult(Activity.java:3349)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.Activity.startActivity(Activity.java:3584)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.Activity.startActivity(Activity.java:3552)
01-27 17:35:03.794:E / AndroidRuntime(7738):在rs.limitline.maxitaxins.MainActivity.callViber(MainActivity.java:96)
01-27 17:35:03.794:E / AndroidRuntime(7738):在rs.limitline.maxitaxins.MainActivity.onClick(MainActivity.java:186)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.view.View.performClick(View.java:4212)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.view.View $ PerformClick.run(View.java:17476)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.os.Handler.handleCallback(Handler.java:800)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.os.Handler.dispatchMessage(Handler.java:100)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.os.Looper.loop(Looper.java:194)
01-27 17:35:03.794:E / AndroidRuntime(7738):在android.app.ActivityThread.main(ActivityThread.java:5431)
01-27 17:35:03.794:E / AndroidRuntime(7738):在java.lang.reflect.Method.invokeNative(本机方法)
01-27 17:35:03.794:E / AndroidRuntime(7738):在java.lang.reflect.Method.invoke(Method.java:525)
01-27 17:35:03.794:E / AndroidRuntime(7738):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:833)
01-27 17:35:03.794:E / AndroidRuntime(7738):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-27 17:35:03.794:E / AndroidRuntime(7738):在dalvik.system.NativeStart.main(本机方法)
[更新]这显示了错误,以及:
01-27 19:46:56.704:D / Greska(19822):权限拒绝:在启动意向书{行为= com.viber.voip.action.CALL DAT =电话:XXXXXXXXX CMP = com.viber.voip / com.viber.service.OutgoingCallBroadcaster(有演员)}从ProcessRecord {416c41b8 19822:rs.limitline.maxitaxins / u0a10065}(PID = 19822,UID = 10065),不是从UID 10147出口
据Viber的的清单,有活动com.viber.voip.phone.PhoneActivity,负责行动com.viber.voip.action。呼叫。在Viber的新版本(4.2.1.1)本次活动的特点是android:exported="false".作为结果,这是不可能的了,从外部应用程序启动本次活动...
修改
这code打开欢迎屏幕指定联系人
字符串的SPhone =12345678;
开放的我们的uri = Uri.parse(电话:+ Uri.en code(SPhone的));
意向意图=新的意图(android.intent.action.VIEW);
intent.setClassName(com.viber.voip,com.viber.voip.WelcomeActivity);
intent.setData(URI);
context.startActivity(意向);
但用户必须点击按钮免费电话,开始通话。
A while ago I created this post, and my colleague and I have found two different answers to it (both of them worked):
First solution was to use
Intent callIntent = newIntent("android.intent.action.CALL_PRIVILEGED");
which would open new window offering for call to be made by allpossible means for placing call - in this particular case, they wereDialer and Viber and Skype (or any other method added later).
Second solution was to explicitly call Viber and place a phonenumber to be called as well
Intent viberCallIntent = new Intent("com.viber.voip.action.CALL");viberCallIntent.setType("vnd.android.cursor.item/vnd.com.viber.voip.call");viberCallIntent.setData(Uri.parse("tel:" + dialNumber));viberCallIntent.putExtra("external_call", true);viberCallIntent.putExtra("contact_id", -1L);startActivity(viberCallIntent);
Since last Viber update (we noticed it yesterday), none of those methods work. First one just calls using Skype, not even offering Dialer (!?!), but if Skype is not installed then it will fall back to Dialer and place call. Second one crashes claiming that there is no Activity found to handle Intent?
Any idea what is happening and how could this be resolved ?
Error log is as follows:
01-27 17:35:03.794: E/AndroidRuntime(7738): FATAL EXCEPTION: main
01-27 17:35:03.794: E/AndroidRuntime(7738): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.viber.voip dat=tel:xxxxxxxxx (has extras) }
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1423)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.Activity.startActivityForResult(Activity.java:3388)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.Activity.startActivityForResult(Activity.java:3349)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.Activity.startActivity(Activity.java:3584)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.Activity.startActivity(Activity.java:3552)
01-27 17:35:03.794: E/AndroidRuntime(7738): at rs.limitline.maxitaxins.MainActivity.callViber(MainActivity.java:96)
01-27 17:35:03.794: E/AndroidRuntime(7738): at rs.limitline.maxitaxins.MainActivity.onClick(MainActivity.java:186)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.view.View.performClick(View.java:4212)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.view.View$PerformClick.run(View.java:17476)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.os.Handler.handleCallback(Handler.java:800)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.os.Handler.dispatchMessage(Handler.java:100)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.os.Looper.loop(Looper.java:194)
01-27 17:35:03.794: E/AndroidRuntime(7738): at android.app.ActivityThread.main(ActivityThread.java:5431)
01-27 17:35:03.794: E/AndroidRuntime(7738): at java.lang.reflect.Method.invokeNative(Native Method)
01-27 17:35:03.794: E/AndroidRuntime(7738): at java.lang.reflect.Method.invoke(Method.java:525)
01-27 17:35:03.794: E/AndroidRuntime(7738): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-27 17:35:03.794: E/AndroidRuntime(7738): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-27 17:35:03.794: E/AndroidRuntime(7738): at dalvik.system.NativeStart.main(Native Method)
[UPDATE]This shows as error as well:
01-27 19:46:56.704: D/Greska(19822): Permission Denial: starting Intent { act=com.viber.voip.action.CALL dat=tel:xxxxxxxxx cmp=com.viber.voip/com.viber.service.OutgoingCallBroadcaster (has extras) } from ProcessRecord{416c41b8 19822:rs.limitline.maxitaxins/u0a10065} (pid=19822, uid=10065) not exported from uid 10147
According to Viber's manifest, there is activity "com.viber.voip.phone.PhoneActivity" that is responsible for action "com.viber.voip.action.CALL". In new version of Viber (4.2.1.1) this activity is marked by android:exported="false". As result, it's not possible anymore to start this activity from external applications...
Edit
This code opens welcome screen for specified contact
String sphone = "12345678";
Uri uri = Uri.parse("tel:" + Uri.encode(sphone));
Intent intent = new Intent("android.intent.action.VIEW");
intent.setClassName("com.viber.voip", "com.viber.voip.WelcomeActivity");
intent.setData(uri);
context.startActivity(intent);
but user should click button "free call" to start call.
这篇关于如何开始从Android应用Viber的通话[新版本]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!