Detect if mobile device supports J2ME WMA
Is it possible to detect if the mobile开发者_JAVA技巧 device supports J2ME WMA?
Use this code,
public static boolean isWMAPresent(){
try {
Class.forName(
"javax.wireless.messaging.MessageConnection" );
return true;
}
catch( Exception e ){
return false;
}
}
For more info see this article, J2ME Optional Packages.
@Bharath's answer is a good one.
Alternative is to check for the existence of SMSC system property as follows:
public static boolean isWMAPresent() {
return System.getProperty("wireless.messaging.sms.smsc") != null;
}
You can also check to see if MMS is supported by checking for MMS property:
public static boolean isWMAPresent() {
return System.getProperty("wireless.messaging.mms.mmsc") != null;
}
精彩评论