Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
577 views
in Technique[技术] by (71.8m points)

android - How Do I Disable AIRPLANE MODE tablet supports 4.4.2

I have to disable AIRPLANE MODE and DATE TIME SETTINGS in my app, for that i used these intent filters but none of them works for me

        <uses-permission android:name="android.permission.WRITE_SETTINGS" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter>
           <action android:name="android.settings.AIRPLANE_MODE_SETTINGS" />
           <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <intent-filter>
           <action android:name="android.settings.DATE_SETTINGS" />
           <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

But earlier i successfully disabled Settings by using below intent-filter

        <intent-filter >
            <action android:name="android.settings.SETTINGS" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As for version 4.2 and up you are not able to control the Airplane mode programmatically.

You are able to do so only if the user has a rooted device.

As written in the API DOC:

"Some device settings defined by Settings.System are now read-only. If your app attempts to write changes to settings defined in Settings.System that have moved to Settings.Global, the write operation will silently fail when running on Android 4.2 and higher. Even if your value for android:targetSdkVersion and android:minSdkVersion is lower than 17, your app is not able to modify the settings that have moved to Settings.Global when running on Android 4.2 and higher."


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...