这里我们需要配置以下项目的 Android platforms,如果用android platforms-26 TelephonyManager会把你坑的体无完肤,会报一大片红,这里我们选择最低版本5.0也就是platforms-23


android 实现电话的监听

https://www.cnblogs.com/haowenbiao/archive/2012/08/15/2639579.html

android 实现电话的监听

这里我示范一下子android platforms-26 或者 是 27 报错的画面看着真爽:

android 实现电话的监听

/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

貌似是我没有证书也是醉了,索性我用最低版本构建,希望这种坑能够帮助过路人!!

另外将android的获取手机信息的方法附在下面:

android 实现电话的监听

相关文章: