I'm hoping someone can help shed some light on this. I have this code that works fine with API Version 10. However, when I switch to API 16, the first component gets loaded, but the second one throws an exception it doesn't exist in the application.
Nothing changes except the change of the API. Can anyone shed any light on this please? I've been searching and haven't ran across anything yet.
Thanks!
/***************************************************
* INITIATE THE BROADCAST RECEIVERS
**************************************************/
//create reference to the package manager and required receivers
PackageManager pm = getApplicationContext().getPackageManager();
ComponentName BroadcastReceiver_Text =
new ComponentName(this, TextMessageReceiver.class.getName());
ComponentName BroadcastReceiver_Phone =
new ComponentName(this, PhoneCallReceiver.class.getName());
//turn ON the broadcast receivers for the texting
try {
pm.setComponentEnabledSetting(BroadcastReceiver_Text,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
Log.i("Broadcast Receiver for Text", "Is Now ENABLED");
//turn ON the broadcast receivers for the phone calls
pm.setComponentEnabledSetting(BroadcastReceiver_Phone,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
Log.i("Phone Receiver for Text", "Is Now ENABLED");
}catch(Exception e){
Log.i("NameNotFoundException", e.getMessage());
}
Log.i("AwayModeService", "OnCreate Ending");
}