如何查看Acumatica当前连接的移动设备及对应IMEI码?
Great question—let’s break this down step by step to cover all your needs:
Out of the box, Acumatica doesn’t have a dedicated screen that lists all currently connected mobile devices with detailed hardware info. However, you can identify active mobile sessions using built-in tools:
- Head to the System Sessions (SM204510) screen.
- Check the
Client Typecolumn—mobile sessions (from either the native app or mobile browser) will typically show up asMobilehere. - This gives you a high-level view of active mobile connections, though it won’t include device-specific details like IMEI by default.
Getting the IMEI depends entirely on how users access Acumatica, due to privacy and platform restrictions:
- Native Acumatica Mobile App: The official app can access the device’s IMEI, but this data isn’t sent to the Acumatica backend automatically. To capture it, you’ll need to customize the mobile app (using the Acumatica Mobile SDK) to send the IMEI as part of session setup (e.g., during authentication). You can then store this IMEI in a custom field on the user record or session table via backend customizations.
- Mobile Browser Access: Browsers block direct access to sensitive hardware identifiers like IMEI for security reasons. There’s no way to retrieve IMEI from users accessing Acumatica via a mobile browser.
You mentioned Acumatica generates Instance IDs but you can’t view them directly. To fetch the current session’s Instance ID via code, use this snippet:
string currentInstanceId = PX.Data.PXInstanceHelper.InstanceID;
If you can’t customize the mobile app to send IMEI, you can use this Instance ID as a proxy for device identification. Pair it with the IsMobile check you already have to track which mobile devices are connected, and store the ID alongside session data for later reference.
IsMobile Check Your existing bool mobile = this.Base.IsMobile; code is perfect for detecting mobile sessions. To build on this, you can create a customization to track mobile sessions and Instance IDs:
First, add custom fields to the SMUserSession table to store mobile status and Instance ID:
public class SMUserSessionExtension : PXCacheExtension<PX.SM.SMUserSession> { #region UsrIsMobileSession [PXDBBool] [PXUIField(DisplayName = "Is Mobile Session")] public virtual bool? UsrIsMobileSession { get; set; } public abstract class usrIsMobileSession : PX.Data.BQL.BqlBool.Field<usrIsMobileSession> { } #endregion #region UsrMobileInstanceID [PXDBString(60)] [PXUIField(DisplayName = "Mobile Instance ID")] public virtual string UsrMobileInstanceID { get; set; } public abstract class usrMobileInstanceID : PX.Data.BQL.BqlString.Field<usrMobileInstanceID> { } #endregion }
Then, add a row inserted event handler to populate these fields when a new session starts:
protected virtual void SMUserSession_RowInserted(PXCache cache, PXRowInsertedEventArgs e) { var session = (SMUserSession)e.Row; var sessionExt = cache.GetExtension<SMUserSessionExtension>(session); sessionExt.UsrIsMobileSession = this.Base.IsMobile; if (sessionExt.UsrIsMobileSession == true) { sessionExt.UsrMobileInstanceID = PX.Data.PXInstanceHelper.InstanceID; } }
Once this is in place, you can add these custom fields to the System Sessions screen to see which sessions are mobile and their associated Instance IDs.
内容的提问来源于stack exchange,提问作者JvD

