开发者

Air app on Android to launch another application

开发者 https://www.devze.com 2023-03-21 21:30 出处:网络
I have an Android AIR application (developed with Flex SDK 4.5.1) for which I need to block the Home Button, as the app is used by patients in a hospital without supervision, i.e. it is crucial that t

I have an Android AIR application (developed with Flex SDK 4.5.1) for which I need to block the Home Button, as the app is used by patients in a hospital without supervision, i.e. it is crucial that they cannot leave the app.

It seems that the only way to hijack the Home Button is to be registered as the default launcher, so that your own app gets the focus when home is pressed. This is easily achieved in the manifest, such as:

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

Now the problem is: If I do quit the application, the original launcher should be made available to the user and I think the solution would be to just start the original lau开发者_高级运维ncher, but how should I do that? The original Android-way of "intents" is not available in AIR and the navigatetoURL() function seems to work only for special URIs, e.g. "market://.." launches the default market app, however, I need to execute an arbitrary application...

Edit: I am referring to a mobile Android App running in this case on an Archos tablet, but it could run on any Android device with AIR installed, such as a typical mobile phone like the HTC desire. With "home button" I am referring to the respective hardware button that allows the user to switch applications (or, to be more exact, to switch to a launcher app that typically shows all the apps as icons to tap on). This "home button" functionality I need to block, as the user should not be able to easily switch to another application.


This is probably a less useful answer but disabling device buttons sounds like something that should be handled at the OS layer and not at the Application layer. Might want to have a custom build of Android for this purpose.

0

精彩评论

暂无评论...
验证码 换一张
取 消