Reputation: 963
I have tried a lot of different ways to do it. Below is my reasons to not being able to use any:
- My app will be installed on more than 200 tablets, so it's gonna kill me if I want to download applications (e.g. Hide Bottom Bar
or full!screen
) for locking my app and installing it on every single tablets.
- Codes are usually working for previous version of android (3) but I'm using JellyBean 4.2
Despite the fact that I have used many programmatic codes in my activity (and non of them was working), I also have tried a lot of different codes in my manifest file.
All I need to do is to disable the soft keys on navigation bar, I don't even want to hide the navigation bar (but if you can suggest a way, why not?)
Below is my code in my manifest file just to show you how many different codes I have tried and still stuck in this thing:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androiddbconnection"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.androiddbconnection.JSONUseActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:stateNotNeeded="true"
>
<intent-filter>
<action android:name="android.settings.SETTINGS" />
<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>
</activity>
<activity
android:name=".Webview"
android:theme="@android:style/Theme.NoTitleBar"
android:label="@string/app_name" >
</activity>
</application>
Any suggestion?
I also had faced this:
You need to write your own home screen app which will implement the lockscreen behaviour that you require. There is sample code for writing your own home screen app in the Android SDK(Source code).
If you think it is a good way, then tell me how to do it?
P.S., I know in this version of android it is considered as a security issue, so please give me something I really can use. Thanks in advance.
Upvotes: 1
Views: 2409
Reputation: 10368
Try this (if you are build your own firmware or you have system UID)
int DISABLE_MASK = StatusBarManager.DISABLE_MASK;
StatusBarManager mStatusBarManager =
(StatusBarManager)getSystemService("statusbar");
mStatusBarManager.disable(DISABLE_MASK_IW);
The DISABLE_MASK constant is defined as:
DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
| DISABLE_SYSTEM_INFO | DISABLE_RECENT
| DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
And you need this permission
<uses-permission android:name="android.permission.STATUS_BAR" />
Here are the detail info of the flags:
public static final int DISABLE_EXPAND = View.STATUS_BAR_DISABLE_EXPAND;
public static final int DISABLE_NOTIFICATION_ICONS = View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS;
public static final int DISABLE_NOTIFICATION_ALERTS
= View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS;
public static final int DISABLE_NOTIFICATION_TICKER
= View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;
public static final int DISABLE_HOME = View.STATUS_BAR_DISABLE_HOME;
public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;
@Deprecated
public static final int DISABLE_NAVIGATION =
View.STATUS_BAR_DISABLE_HOME | View.STATUS_BAR_DISABLE_RECENT;
public static final int DISABLE_NONE = 0x00000000;
Upvotes: 1