1
나는 왜 내 간단한 SMS 수신기가 내 에뮬레이터 (2.3)에서 작동하지만 내 전화 (2.3)에서는 작동하지 않는지 알고 싶었습니다.안드로이드 - SMS BroadcastReceiver 에뮬레이터에서 작동하지만 전화가 아닙니다.
내 간단한 프로그램은 새로운 SMS를받을 때마다 축배를 보여줍니다. 에뮬레이터에 표시되고 있으며 휴대 전화에는 표시되지 않습니다.
2 개의 에뮬레이터를 사용해 보았습니다.
다음은 코드입니다.
public class SMSReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
System.out.println("A new message just arrived.");
Toast.makeText(context, "weee", Toast.LENGTH_LONG).show();
}
}
매니페스트 :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smsreceiver"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.smsreceiver.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".SMSReceiver" android:exported="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
</application>
</manifest>
logcat 출력? – Akdeniz
Hello @Akdeniz, 문제가 발견되었습니다. 그것은 GO SMS 때문입니다. 그들은받은 메시지를 처리 한 후 SMS 브로드 캐스트를 중단합니다. – user1732887