-2

皆さん、こんにちは、私は真の発信者のようなアプリを開発しました。トーストに連絡先番号を表示しているだけです.tats it.iは、これをAndroidバージョン2.2(api 8)でコンパイルしました。アプリはアンドロイド 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 に答える