我正在尝试实现 SMS Retriever API 以进行 SMS 验证。文档中提到的官方方式说GoogleApiClient与HintRequest从设备检索手机号码一起使用
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
googleApiClient, hintRequest);
try {
startIntentSenderForResult(intent.getIntentSender(),
RESOLVE_HINT, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但是GoogleAPIClient已弃用并由GoogleApi接口代替,例如GoogleSignInClient. 我尝试使用GoogleSignInClient但getHintPickerIntent不接受。即使在被弃用后使用旧 API 是否安全,或者有没有办法将后者与 SMSRetriver API 一起使用?
android google-api google-api-client googlesigninapi sms-retriever-api
我在我的项目中使用 Kotlin 实现了 RoomDatabase。我不断收到以下错误。
error: ProductDatabase_Impl is not abstract and does not override abstract method getProductDao()
in ProductDatabase
public final class ProductDatabase_Impl extends ProductDatabase {
Run Code Online (Sandbox Code Playgroud)
这是我的 Dao 接口和 ProductDatabase:
@Dao
interface ProductDao {
@Insert
suspend fun insertProduct(product: Product) : Long
@Insert
suspend fun insertAll(products: ArrayList<Product>) : List<Long>
@Update
suspend fun updateProduct(product: Product) : Int
@Query("SELECT * FROM product_table")
fun getAllProducts() : LiveData<List<Product>>
}
@Database(entities = [Product::class], version = 1)
abstract class ProductDatabase : RoomDatabase() {
abstract fun productDao(): ProductDao
abstract …Run Code Online (Sandbox Code Playgroud)