目前,我向用户提供一个 URL,单击该 URL 即可下载我的 j2me 应用程序。该 URL 包含其用户 id 作为参数,servlet 获取该信息并动态创建包含该用户 id 的 jad 文件,从而使该用户 id 可用于 j2me 应用程序。
但是,我现在使用 j2me Polish 来编译我的程序,因此为同一程序编译了 .apk。但是,我无法弄清楚如何使编译后的程序可以访问这些信息,因为没有 jad / jar 机制。该信息仅在下载时可用。
如有任何建议,不胜感激! (这在 Android 应用程序中是否可能?)
谢谢,
CJ
p.s.我必须从用户的角度假设完全文盲,即我不能要求他们首先安装其他程序等,它需要是一个简单的“单击链接”-> “获取应用程序”之类的事情。
Currently I supply a user with a URL to click on to download my j2me application. This URL includes their user id as a parameter, a servlet takes this information and dynamically creates a jad file that includes this user id , thus making the user id available to the j2me app.
However, I am now using j2me polish to compile my program and thus have the compiled .apk for this same program. However, I cannot work out how to make this information accessible to the the compiled program as there is no jad / jar mechanism. The information is only available at the time of download.
Any suggestions gratefully received! (is this even possible in an android application?)
Thanks,
CJ
p.s. I have to assume complete illiteracy from the users point of view, i.e. I cannot ask them to first install other programs etc, it needs to be a simple "click on the link" -> "get the app" sort of thing.
.apk
格式基于.jar
格式,因此它只是一个 ZIP 文件,这意味着您可以使用任何处理 ZIP 文件的文件打开它。应用程序的
assets
文件夹中的文件不会被.apk
构建过程更改,因此应该可以将 URL 存储在的文本文件中>assets
然后使用 "="">AssetManager.open()
。您的服务器必须打开.apk
并更新assets
中的文本文件,然后才能提供下载。然而,一个复杂的问题是所有 Android 应用程序都必须签名 否则他们不会安装。即使您不通过市场分发您的应用程序,情况也是如此。因此,除了更新
.apk
文件外,您的服务器还必须使用keytool
之类的工具对其进行重新签名。The
.apk
format is based on the.jar
format so is just a ZIP file meaning you can open it with anything that processes ZIP files.Files which are in the
assets
folder of your application aren't altered by the.apk
build process so it should be possible to store the URL in a text file inassets
and then read it usingAssetManager.open()
. Your server would have to open the.apk
and update the text file inassets
before offering it for download.However, a complication is that all Android applications must be signed or they will not install. This is true even if you're not distributing your application via the Market. So as well as updating the
.apk
file your server would have to re-sign it using something likekeytool
.