Esempio di codice: Recupero della posizione dell'utente
L'esempio di codice seguente presuppone che la classe che ha visualizzato MyUserProfileBoxScreen abbia passato un riferimento all'oggetto BBMPlatformContext associato all'applicazione nel costruttore MyUserProfileBoxScreen.
import net.rim.blackberry.api.bbm.platform.*;
import net.rim.blackberry.api.bbm.platform.profile.*;
import net.rim.device.api.system.*;
import java.util.*;
public class MyUserProfileBoxScreen extends MainScreen
{
public MyUserProfileBoxScreen(BBMPlatformContext platformContext)
{
UserProfile userProfile = platformContext.getUserProfile();
UserProfileLocation userProfileLocation = userProfile.getUserProfileLocation();
if(userProfileLocation != null) {
String countryCode = userProfileLocation.getCountryCode();
Bitmap countryIcon = userProfileLocation.getCountryIcon();
TimeZone timeZone = userProfileLocation.getTimeZone();
} else {
// User has not enabled location in profile
}
}
}
Argomento successivo: Definizione dei listener di un servizio
Argomento precedente: Recupero della posizione dell'utente
Le informazioni sono state utili? Inviateci i vostri commenti.