Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

java - Privileged operations in netbeans mobility

I'm writing a Java ME app that will use privileged operations such as messaging. By default the user is prompted to confirm each of these operations, but I would like to run it as a background service.

Documentation says to request permission in the jad file, I have done so and presume it will work on a device. However I would like to test this on the Netbeans mobility emulator first.

I tried signing the app as "trusted" but my emulated execution still prompts the user for permission.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

The MIDP security model needs to be explained in 2 parts:

The phone (or the emulator) contains a security policy.
The security policy is made of several domains.
each domain defines function groups and root certificates.
a function group decides which protection options (auto agree always, user agree always, user agree once...) are available in the domain for which protected API (i.e. messaging).

The domain that applies to your MIDlet depends on which of the root certificates trusts the certificate you signed your MIDlet with.

Your problem is that there is a mismatch between what you think the protection options should be for the API you want in the domain you think your MIDlet belongs too and what is actually defined in the emulator security policy.

EDIT:

how-to for WTK-based emulators:

There are 3 _policy.txt* files in the ${netbeans_installation_folder}mobility8WTK2.5.2j2mewtk_templateappdb folder.

They each contain a list of "alias" definitions and a list of "domain" definitions.

Make every domain have the same content as the "maximum" domain.

After this, Your emulator will never again ask for any user permission.

If you have already used the emulator contained in Netbeans, you probably want to make the same changes to the ${netbeans_installation_folder}mobility8WTK2.5.2appdb folder.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...