I am working on application that tracks the InComing/Outgoing calls & save calls records into Database.
Yesterday I seen a scenario In which application is terminated by OS & a warning message pops Up (Error: Application is not responding). After application is terminated by OS. Application is not able to listen In Coming/Outgoing calls again.
I think, Application Phone Listener is unregistered by abnormal application termination.
Os calls System.Exit(0)
for application termination
If I follow this approach :-
public static void main(String[] args)
{
/**
* Registering the phone Listener.
* */
Phone.addPhoneListener( new ConcretePhoneListener() );
new SampleUIApp().enterEventDispatcher();
}
In this case every time at the application start up , phone listener is registered. And Application's (Phone Listener) registered multiple times. Means for a single In/Out Call I am getting multipule times
void callConnected( int aCallId )
callDisconnected( int aCallId )
for sourt out this issue , I am using RunTime Store Management System. For this I am using Following approach :-
private static void registeringPhoneListener()
{
RuntimeStore mRuntimeStore = RuntimeStore.getRuntimeStore();
final long GUID = 0xba9e3b33ac5fe37eL;
String msPhoneListenerString = null;
if(mRuntimeStore.get(GUID) != null)
{
Log.debug( "PhoneListener is Already Implemented ## ");
}
else
{
Phone.addPhoneListener( new ConcretePhoneListener() );
mRuntimeStore.put(GUID, "PhoneListener");
Log.debug("PhoneListener Implemented First Time ## " );
}
}
this Approach is working fine until I get abnormal termination by OS, Because RuntimeStoreManagemnet is not null but Application Phone-listener is Derigester.
please Help me out this.