-2

大家好,我已经开发了一个像真正的来电者这样的应用程序。我只是在祝酒词中显示联系号码,tats it.我在 android 版本 2.2(api 8)中编译了这个。应用程序在 android 2.3 和 2.3.3 中运行良好,但在 4.0.1 和 4.1.0 中无法正常工作..可能是什么问题..????

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17" />


<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

     <receiver android:name=".CustomBroadcastReceiver">
    <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />     
    </intent-filter>
    </receiver>



</application>


this is my logcat error on android emulator api 17

10-28 07:22:28.950: D/CallNotifier(392): RINGING... (new)
10-28 07:22:28.950: D/CallNotifier(392): onNewRingingConnection(): state = RINGING, conn = {  incoming: true state: INCOMING post dial state: NOT_STARTED }
10-28 07:22:28.998: D/CallNotifier(392): SignalInfoTonePlayer.run(toneId = 98)...
10-28 07:22:29.078: D/PhoneNumberUtils(392): System property doesn't provide any emergency numbers. Use embedded logic for determining ones.
10-28 07:22:29.148: D/PhoneStatusBar(664): disable: < expand icons ALERTS* ticker system_info back home recent clock search >
10-28 07:22:29.258: D/AccelerometerListener(392): enable(false)
10-28 07:22:29.328: I/Choreographer(392): Skipped 45 frames!  The application may be doing too much work on its main thread.

10-28 07:22:29.648: W/CallNotifier(392): CallerInfo query took too long; look up local fallback cache.
10-28 07:22:29.657: D/CallNotifier(392): Failed to find fallback cache. Use default ringer tone.
10-28 07:22:29.657: W/CallNotifier(392): CallerInfo query took too long; falling back to default ringtone
10-28 07:22:29.808: D/CallNotifier(392): showIncomingCall()...  phone state = RINGING
10-28 07:22:29.867: W/Trace(289): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:29.867: W/Trace(289): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:29.908: W/Trace(405): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:29.918: W/Trace(405): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:29.968: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.069: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.219: I/Choreographer(664): Skipped 140 frames!  The application may be doing too much work on its main thread.
10-28 07:22:30.249: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.249: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.308: D/MediaPlayer(392): Couldn't open file on client side, trying server side
10-28 07:22:30.308: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.318: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.369: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.398: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.448: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.448: W/Trace(664): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:30.578: E/MediaPlayerService(40): Couldn't open fd for content://settings/system/ringtone
10-28 07:22:30.578: E/MediaPlayer(392): Unable to to create media player
10-28 07:22:30.609: D/Ringtone(392): Problem opening; delegating to remote player
10-28 07:22:30.739: I/AudioService(289):  AudioFocus  requestAudioFocus() from AudioFocus_For_Phone_Ring_And_Calls
10-28 07:22:30.788: D/AudioHardwareInterface(40): setMode(RINGTONE)
10-28 07:22:31.058: D/MediaPlayer(664): Couldn't open file on client side, trying server side
10-28 07:22:31.078: E/MediaPlayerService(40): Couldn't open fd for content://settings/system/ringtone
10-28 07:22:31.199: E/MediaPlayer(664): Unable to to create media player
10-28 07:22:31.199: W/Ringtone(664): Remote playback not allowed: java.io.IOException: setDataSource failed.: status=0x80000000
10-28 07:22:31.258: D/Ringtone(664): Problem opening; delegating to remote player
10-28 07:22:31.279: W/Ringtone(664): Neither local nor remote playback available
10-28 07:22:31.568: W/Trace(392): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:31.619: W/Trace(392): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:31.968: I/ActivityManager(289): START u0 {act=android.intent.action.MAIN flg=0x10840000 cmp=com.android.phone/.InCallScreen} from pid -1
10-28 07:22:31.978: W/Trace(289): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.048: W/Trace(289): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.228: W/WindowManager(289): Failure taking screenshot for (164x246) to layer 21015
10-28 07:22:32.228: W/Trace(405): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.339: W/Trace(392): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.369: W/Trace(289): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.477: W/Trace(289): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.557: W/Trace(392): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.598: I/Choreographer(289): Skipped 31 frames!  The application may be doing too much work on its main thread.
10-28 07:22:32.618: W/Trace(392): Unexpected value from nativeGetEnabledTags: 0
10-28 07:22:32.677: D/InCallScreen(392): onNewIntent: intent = Intent { act=android.intent.action.MAIN flg=0x10c40000 cmp=com.android.phone/.InCallScreen }, phone state = RINGING
4

1 回答 1

0

我想你是这样使用的

  TelephonyManager manager =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
  mPhoneNumber = manager.getLine1Number();

并祝酒您正在使用的此方法是SDK中唯一可以执行此操作的部分,并且仅适用于将号码存储在SIM卡上的设备,(设置->关于手机->状态->检查号码是否可见, 如果是,则仅显示号码)对于所有其他运营商,您必须要求用户手动输入电话号码

于 2013-10-28T05:46:03.877 回答