Thank u so much Levis. This source code is working.
public static boolean isAirplaneModeOn(Context context)
{
return Settings.System.getInt(context.getContentResolver
(),Settings.System.AIRPLANE_MODE_ON, 0) != 0;
}
/**
*
* @param status
*/
public static void setAirplaneMode(Context context,boolean
status)
{
boolean isAirplaneModeOn = isAirplaneModeOn(context);
if(isAirplaneModeOn && status)
{
return;
}
if(!isAirplaneModeOn && !status)
{
return;
}
if(isAirplaneModeOn && !status)
{
Settings.System.putInt(AppContext.getInstance().getContext
().getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0);
Intent intent = new Intent
(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", 0);
AppContext.getInstance().getContext().sendBroadcast
(intent);
return;
}
if(!isAirplaneModeOn && status)
{
Settings.System.putInt(AppContext.getInstance().getContext
().getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 1);
Intent intent = new Intent
(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", 1);
AppContext.getInstance().getContext().sendBroadcast
(intent);
return;
}
}
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---