Flight mode doesn't enable in the real device
<p>I made an app which can enable the flight mode. It perfectly works for the Emulator, but it doesn't work for the real device(Samsung Galaxy y). Can someone help me on this?</p>

<p>This is the code I used:</p>

<pre><code>boolean isEnabled = android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, 0) != 0; 
if(isEnabled == false) { 
    android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1); 
    Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); 
    intent.putExtra("state", 1); 
    context.sendBroadcast(intent); 
}            
} else { 
    android.provider.Settings.System.putInt(context.getContentResolver(), 
    android.provider.Settings.System.AIRPLANE_MODE_ON,0); 
    Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); 
    intent.putExtra("state", 0); 
    context.sendBroadcast(intent); 
} 
</code></pre>
