-2
的Android VoiceMailContract代碼:的Android 4.0+ VoiceMailContract沒有顯示正確的結果
public void voiceMail(Context ctx) {
if (Build.VERSION.SDK_INT >= 14) {
try {
final String selection = VoicemailContract.Voicemails.IS_READ + "=0";
final String sortOrder = VoicemailContract.Voicemails.DATE + " DESC";
String uri = VoicemailContract.Voicemails.CONTENT_URI + "?"
+ VoicemailContract.PARAM_KEY_SOURCE_PACKAGE + "="
+ getPackageName();
Cursor cursor = ctx.getContentResolver().query(Uri.parse(uri), null,
selection, null, sortOrder);
TextView tv = (TextView)findViewById(R.id.textView1);
tv.setText("You have "+cursor.getCount()+" voice mail");
cursor.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
它總是顯示我0語音郵件,我也希望整合谷歌語音郵件, 在此先感謝
純代碼編寫工作的要求是題外話上堆棧溢出(你至少可以抽出時間寫一個完整的句子)。 – assylias