我在清单文件中添加了android:进程,然后我加载应用程序已经停止弹出,同时加载apk。服务没有加载,但剩下的东西运行正常。
showDetail
答案 0 :(得分:0)
在最顶层的文件中添加权限 像这样
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ncrypted.otp">
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"/>
比应用程序标签中的接收器sevrcice
<receiver android:name=".SmsReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
比处理像这样的lolipop virsions的运行时间permision
private void requestSmsPermission() {
String permission = Manifest.permission.READ_SMS;
int grant = ContextCompat.checkSelfPermission(this, permission);
if (grant != PackageManager.PERMISSION_GRANTED) {
String[] permission_list = new String[1];
permission_list[0] = permission;
ActivityCompat.requestPermissions(this, permission_list, 1);
}
}