English 中文(简体)
Kiosk手法
原标题:Kiosk mode in Android

正在评估是否和如何建立一个合作框架。 该网络的企业应用可以安装在安乐器上。 视窗移动电话的应用程序以千丝万.的方式运行,在接线后,申请自动启动全部屏幕上,用户不能意外或自愿地进入电话的任何其他部分。

www.un.org/Depts/DGACM/index_spanish.htm 是否在安乐斯,在boot后只有一次自动启动申请,防止用户意外(或自愿)进入安乐器的任何其他部分?

最佳回答

可以通过倾听广播台的<代码>android.intent.action.BOOT_COMPLETED意向,从那里开始活动,使申请站自动启动。 在这项活动中,你可以将采购处登记为新的缺省房屋屏幕?

我认为,在某些情况下,你可以在不修改框架的情况下处理(例如,在家中用长期压力表示目前积极的申请),但我也会被错。

但是,对于一个足够原型而言。

Have!

***

<intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.HOME" />
 <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
问题回答

在新的《圣经》审查中,谷歌宣布了Task Locking, 确实如此。 但这似乎需要根基。

The L Developer Preview introduces a new task locking API that lets you temporarily restrict users from leaving your app or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android. Once your app activates this mode, users will not be able to see notifications, access other apps, or return to the Home screen, until your app exits the mode.

To prevent unauthorized usage, only authorized apps can activate task locking. Furthermore, task locking authorization must be granted by a specially-configured device owner app, through the android.app.admin.DevicePolicyManager.setLockTaskComponents() method.

建立装置所有人,遵循这些步骤:

  • Attach a device running an Android userdebug build to your development machine.
  • Install your device owner app.
  • Create a device_owner.xml file and save it to the /data/system directory on the device.
$ adb root
$ adb shell stop
$ rm /tmp/device_owner.xml
$ echo "<?xml version= 1.0  encoding= utf-8  standalone= yes  ?>" >> /tmp/device_owner.xml
$ echo "&device-owner package="<your_device_owner_package>" name="*<your_organization_name>" />" >> /tmp/device_owner.xml
$ adb push /tmp/device_owner.xml /data/system/device_owner.xml
$ adb reboot

Before using the task locking API in your app, verify that your activity is authorized by calling DevicePolicyManager.isLockTaskPermitted().

To activate task locking, call android.app.Activity.startLockTask() from your authorized activity.

在执行任务时,采取下列行动:

  • The status bar is blank, and user notifications and status information is hidden.
  • The Home and Recent Apps buttons are hidden.
  • Other apps may not launch new activities.
  • The current app may start new activities, as long as doing so does not create new tasks.
  • The user remains locked on your app until an authorized activity calls Activity.stopLockTask().

页: 1

我在寻求这一点后,便提出了一个很好的解决办法。 但我猜测,如果仅仅为了这一目的,就把它根植起来就是一个问题。

还检查http://thebitplague.wordpress.com/04/05/kiosk-mode-on-the-nexus7/。 另一种方式

Starting your app on boot

实现这一目的的方法是确定你作为发射者的意愿。

<activity ...
  android:launchMode="singleInstance"
  android:windowActionBar="false">
    <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.HOME" />
      <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

Locking your app

最可靠的方式是使用一种带有Lollipop或更大程度的装置,并利用这种装置。

startLockTask

首先,你们必须把自己的东西作为装置所有人。 贵重装置必须不预设:如果你登记,你就应进行工厂重建,并加快账户登记。

您必须首先建立感化器部件。

package com.example.myapp;

public class MyDeviceAdminReceiver extends android.app.admin.DeviceAdminReceiver {
    @Override
    public void onEnabled(Context context, Intent intent) {
        Toast.makeText(context, "Device admin permission received", Toast.LENGTH_SHORT).show();
    }

    @Override
    public CharSequence onDisableRequested(Context context, Intent intent) {
        return "are you sure?";
    }

    @Override
    public void onDisabled(Context context, Intent intent) {
        Toast.makeText(context, "Device admin permission revoked", Toast.LENGTH_SHORT).show();
    }


    @Override
    public void onLockTaskModeExiting(Context context, Intent intent) {
        // here you must re-lock your app. make your activity know of this event and make it call startLockTask again!
    }
}

一旦有了未经预想的装置,你就可以从旁边发射以下指挥器(no fundamental required)。

adb shell dpm set-device-owner com.example.myapp/.MyDeviceAdminReceiver

to avoid android asking the user permissions to pin your app you must call setLockTaskPackages

最后!

@Override
public void onResume(){
    super.onResume();
    DevicePolicyManager mDevicePolicyManager = (DevicePolicyManager) getSystemService(
            Context.DEVICE_POLICY_SERVICE);
    ComponentName mAdminComponentName = new ComponentName(getApplicationContext(), MyDeviceAdminReceiver.class);
    mDevicePolicyManager.setLockTaskPackages(mAdminComponentName, new String[]{getPackageName()});
    startLockTask();
}
@Override
public void finish(){
    stopLockTask();
    super.finish();
}

谷歌最近发行了Android Management AP,该软件允许方便地为任何有色人种的 Android装置安装Kiosk模式,并制定了其他各种政策。

rel=“nofollow> 安装单一波束装置()和甲状腺开发商已经描述了你可以轻易从那里获得更多东西。

现在很容易将Android 6.0 marmallow和作为公司拥有的单一用途装置。

http://www.basic4ppc.com/forum/basic4android-started-tutorials/10839-android-kiosk-mode-tutorial.html“rel=“nofollow”>forum post。 指定该员额:

rel=“nofollow” http://www.basic4ppc.com/forum/basic4android-started-tutorials/10839-android-kiosk-mode-tutorial.html

Using the following methods you can build an application that will prevent "regular" users from playing with anything other than your application.

The application is made of two modules. The main activity and a service. The service is configured to start at boot. When the service is started it checks if the activity is running or not. If it is not running it uses a timer to start the main activity.

When the activity is paused it schedules the service to start in one second: Code:

Sub Activity_Pause (UserClosed As Boolean)
    If kiosk Then StartServiceAt(KioskService, DateTime.Now + 1 * DateTime.TicksPerSecond, false)    
End Sub

If the user presses on the home screen, the home screen will appear for several seconds. However your application will return to the front after a few seconds and the user will not be able to interact with any other applications or change the settings.

The service is set to be a foreground service. This prevents Android from killing our service. Press on the Stop button to deactivate kiosk mode.

http://www.basic4ppc.com/android/forum/attachments/kiosk-zip.17108/“rel=“nofollow”>example kiosk-modecode ZIP 也可下载





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签