I\'m trying to develop an application which silently dismiss the USSD responses. I\'ve used the code from http://commandus.com/blog/?p=58 with minor changes. I\'ve created t
Have you declared your broadcast receiver in your manifest file?
add inside your manifest:
<receiver android:name="com.xxx.receivers.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="your.package.ExtendedNetworkService" />
in BootReceiver.java :
public void onReceive(Context context, Intent intent) {
context.startService(new Intent(context,ExtendedNetworkService.class));
}
in ExtendedNetworkService.java :
public class ExtendedNetworkService extends Service {
IExtendedNetworkService.Stub binder = new IExtendedNetworkService.Stub() {
public void setMmiString(String number) throws RemoteException {}
public CharSequence getMmiRunningText() throws RemoteException {
return null;
}
public CharSequence getUserMessage(CharSequence text)
throws RemoteException {
Log.d(Constants.TAG, "Message : " + text);
Log.d(Constants.TAG, "getMmiRunningTest() : " + getMmiRunningText());
return null;
}
public void clearMmiString() throws RemoteException {
}
};
return false;
}
public void onCreate() {
Log.d(Constants.TAG, "ExtendedNetworkService Started..");
super.onCreate();
}
public IBinder onBind(Intent arg0) {
Log.d(Constants.TAG, "ExtendedNetworkService got binded...");
return binder;
}
}
Complete working code sample https://github.com/alaasalman/ussdinterceptor
Enjoy!
Please note that, this interface IExtendedNetworkService was removed starting from Android 4.2.2 No alternative provided by Google yet, and no plans to provide such alternative For reference you can see http://code.google.com/p/android/issues/detail?id=57120.
If your using android 3.1 (API 12), when an app installs it's in a stopped state by default until the user starts your app explicitly as stated in the commonsblog:
http://commonsware.com/blog/2011/07/13/boot-completed-regression-confirmed.html
and in the android documentation:
http://developer.android.com/about/versions/android-3.1.html#launchcontrols
I believe the bottom line is that an app containing only an IntentService or BroadcastReceiver cannot be started by it's own.