tags:

views:

242

answers:

1

Hi,

I'm trying to detect when the roaming activation occurs. So far I've used the following piece of code, but because I haven't been able to test it I am unaware of it's correctness

TelephonyManager telephonyManager = TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); 

PhoneStateListener cellLocationListener = new PhoneStateListener() {
public void onCellLocationChanged(CellLocation location) {
  if(telephonyManager.isNetworkRoaming()
  {
    Toast.makeText(getApplicationContext(),"in roaming",Toast.LENGTH_LONG).show();
   }
 }
};

telephonyManager.listen(cellLocationListener, PhoneStateListener.LISTEN_CELL_LOCATION);

I've written this , thinking that in order for roaming to activate first the signal cell must change. Please let me know whether my deduction is correct or not, and if not how could I accomplish this.