안드로이드 개발 질문/답변
(글 수 45,052)
AndroidMenifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mint.TestService2" android:versionCode="1" android:versionName="1.0"> <receiver android:name="MyReceiver"> <intent-filter> <action android:name="android.provider.telephony.SMS_RECEIVED" /> <!--<action android:name="android.intent.action.BOOT_COMPLETED" />--> </intent-filter> </receiver> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <!--<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />--> </manifest>
mint.TestService2
package mint.TestService2; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class MyReceiver extends BroadcastReceiver { private static final String TAG = "==============="; @Override public void onReceive(Context context, Intent intent) { Log.e(TAG , "**************************"); Log.e(TAG, "**************************"); Log.e(TAG, "**************************"); } }
부팅이 끝나면 브로드캐스트 리시버가 작동되게 하는게 목표인데, 그게 안되서 sms를 받을때 동작되게 바꿔봤습니다.
근데 여전히 아무런 동작이 안됩니다.
혹시나 에뮬레이터로 해서 동작이 안되는걸까요?
2010.08.27 15:56:38
android.provider.Telephony.SMS_RECEIVED T가 대문자에요,,
Boot_Complete은
<category android:name="android.intent.category.LAUNCHER" />
를 추가하면 될듯,,
2010.08.27 17:01:26
이럴수가.......
<application android:icon="@drawable/icon" android:label="@string/app_name">
<
receiver>
.
.
</
receiver>
</application>
로 해줘야하네요 ㅠㅠ
소스 편집하다가 저거까지 몽창 날렸었나봐요 ㅠㅠ