com.google.android.gms.common.api.ApiException: 17: Device doesn't support the messaging feature我遇到了类似于Android 13 中的异常
它在另一个版本以及 Android studio 中的 Android 13 模拟器上运行良好,但当我连接 Android 13 物理设备时,它会抛出上述错误。
try {
SmsRetrieverClient mClient = SmsRetriever.getClient(this);
Task<Void> mTask = mClient.startSmsRetriever();
mTask.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Bundle bundle = new Bundle();
bundle.putString("mobile", stringFromView(binding.etPhoneNumber));
bundle.putString("setting", settingScreen);
startActivity(OtpActivity.class, bundle);
// Toast.makeText(mContext, "SMS Retriever starts", Toast.LENGTH_LONG).show();
}
});
mTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
e.printStackTrace();
}
});
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud) java android google-cloud-messaging firebase-cloud-messaging