안드로이드 개발 질문/답변
(글 수 45,052)
전화를 걸거나 Booting이 완료하면 서비스를 띄우고 그 서비스에서는 Activity를 실행하도록 프로그래밍을 했습니다.
그런데, 실행하면 다음과 같은 Log가 logcat에 잡히고, 실행이 되지 않습니다.
01-14 08:41:20.050: W/ActivityManager(16756): Unable to launch app com.inervit.test/10015 for broadcast Intent { act=android.intent.action.NEW_OUTGOING_CALL (has extras) }: process is bad
이렇게 나오는 이유가 무엇인가요?
코드 구현은 다음과 같습니다.
AndroidManifext.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.inervit.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permistion android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<service android:name= ".svcViewControler"/>
<activity android:name=".CI_Recv"/>
<receiver android:name=".HC_Gate"
android:permission="android.permission.PROCESS_OUTGOING_CALLS">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
</application>
</manifest>
BroadcastReceiver는 다음과 같습니다.
public class HC_Gate extends BroadcastReceiver { @Override
public IBinder peekService(Context myContext, Intent service) {
// TODO Auto-generated method stub
return super.peekService(myContext, service);
}
@Override
public void onReceive(Context mContext, Intent intent) {
// TODO Auto-generated method stub
Log.d("HC_Gate", intent.getAction());
if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
Log.d("HC_Gate", "Intent received");
ComponentName cn = new ComponentName(mContext.getPackageName(), svcViewControler.class.getName());
ComponentName svcName = mContext.startService(new Intent().setComponent(cn));
if (svcName == null)
Log.e("HC_Gate", "Could not start service " + cn.toString());
}else if(intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
Log.d("HC_Gate", "Intent received");
ComponentName cn = new ComponentName(mContext.getPackageName(), svcViewControler.class.getName());
ComponentName svcName = mContext.startService(new Intent().setComponent(cn));
if (svcName == null)
Log.e("HC_Gate", "Could not start service " + cn.toString());
}
}
}
Service는 다음과 같이 구현하였습니다.
public class svcViewControler extends Service { private static Context mContext = null;
@Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; }
@Override protected void finalize() throws Throwable { // TODO Auto-generated method stub super.finalize(); }
@Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); mContext = getApplication(); }
@Override public int onStartCommand(Intent intent, int flags, int startId) { Intent activeIntent = new Intent(mContext, CI_Recv.class);
startActivity(activeIntent);
// TODO Auto-generated method stub return super.onStartCommand(intent, flags, startId); }}여기서 호출되는 Activity는 그냥 일반적인 Activity 입니다.
버튼 하나와 TextView 하나 두고, 버튼 누르면 Activity가 닫히도록 한...
Sample 정도 수준으로 구현하였는데, 이걸 해결을 못 하고 이 밤을 꼴딱 했네요.
제 코드에 무슨 문제가 있는지 좀 봐주세요~~~




http://stackoverflow.com/questions/3253676/how-to-fix-process-is-bad-error-for-an-android-widget
보시면 해결방법나와있네요
님의 코드상문제가 아니라 안드로이드 문제같아요
1. 앱을 지운다.
2. 폰 리붓.
3. 앱에서 이 기능을 뺀다...