How do I select which device to compile too?

BarrySumpter

Active Member
Licensed User
Longtime User
Hi all,

I know I get a pop up when I have one physical device and the emulator running at the same time.

I've got 2 physical HTC HD2s connected to my computer.
Without the emulator.
How do I select which physical device to compile too.

tia
 

mc73

Well-Known Member
Licensed User
Longtime User
Sometimes I compile with 2-3 devices usb-plugged, and I always get a popup to select. Or perhaps you mean something else, as for e.g. what is the id of the device to choose?
 
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Yeah, ok.
Thanks for that confirmation.

I've got two hd2s plugged in via usb.
But only one will be recognized by B4A.

With both blugged in and the emulator running.
I do get that pop up but only with the emulator and onle ONE hd2.

If I have both plugged in without the emulator,
no pop up and
B4A just compiles to the last one I plugged in.

If anyone has any suggestions I would be happy to try them.

Maybe its the two hd2s.
Maybe I shold try wireless?

...

yep, that did it.
Wireless. But had to install the B4A bridge on the phone first.

Now I have all three.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the logic:

Standard compilation (Alt + 1 or Play button) - if there is more than one device connected then you will always see a dialog with the list of devices.
Background compilation (Alt + 3) - the last chosen device is used.

I usually use background compilation. If I want to switch a device or emulator then I use standard compilation once to choose a different device.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I am not sure 100% about this but I believe all HTC HD2-phones "share" the same ID (Device Serial) since its Android-base is the same among all phones. This is because the HD2 was not a native Android-phone from the beginning.

Mine is for instance 0123456789ABCDEF

This might be the cause of your problems using USB.
 
Last edited:
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Hi all,

Thanks to all who took the time to reply.

Much appreciated.

--

Good call Moster.

I'll see if I can change the Device Serial.

Thanks heaps!

---
Oops my bad.
Using my B4A ipAddress app that also shows the Device/Phone ID.
They are both different.
Not even close.
---
Unless the ID is NOT the Device Serial.
more research ...
 
Last edited:
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Now me head hurts:

B4X:
'Activity module
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    
    Dim lbl As Label
    
    Dim ph1 As Phone

End Sub

Sub Activity_Create(FirstTime As Boolean)

    lbl.Initialize("lbl")
    lbl.TextSize = 18
    Dim now As Long
    now = DateTime.Now
    lbl.Text = DateTime.Date(now) & " - " & DateTime.Time(now)    

    Activity.AddView(lbl,  5dip, 10dip, 100%X - 5dip,  100%Y - 10dip)

    Dim MyLan As ServerSocket
    MyLan.Initialize(0, "")
    MyLan.Listen

    Dim p As Phone

    myDevice = "Device/phone/Serial ID: " & p.GetSettings("android_id")

    Dim myWifi As ABWifi 
    myWifi.ABLoadWifi()
  mymac = "Mac Address: " & myWifi.ABGetCurrentWifiInfo().MacAddress 

    Dim Serial1 As Serial
    Serial1.Initialize("serial1")
  
    Dim BTName As String
    BTName = "BTName: " & Serial1.Name

    Dim pid As PhoneId
    Dim IMEI As String
    IMEI = "IMEI is: " & pid.GetDeviceId


  'Msgbox("ipAdddress: " & MyLan.GetMyIP & CRLF & myDevice & CRLF & mymac & CRLF & BTName & CRLF & serialNo, "")
  lbl.Text = lbl.Text & CRLF & CRLF & "ipAdddress: " & MyLan.GetMyIP & CRLF & myDevice & CRLF & mymac & CRLF & BTName & CRLF & IMEI 


End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
With both of your mobiles connected, open a command prompt and type:

B4X:
adb devices

Do you see one or two devices?

I think that the device id that adb shows is not 'set in stone'...

On my ZTE Blade running CynaogenMod7, it shows up in the list as 'CM7-Blade'.
That's obviously not a serial number or any other unique id.
And CyanogenMod has added a new option to the Settings > Development screen where you can manually set whatever name you want the device to appear as in adb.
That option is named 'Device hostname' so maybe hostname is what adb displays?

I've seen many people ask how to change the name that adb displays but never seen a solution: https://www.google.co.uk/search?q=android+adb+set+device+hostname&ie=UTF-8&oe=UTF-8

Martin.
 

Attachments

  • device_hostname1.png
    74.2 KB · Views: 256
  • device_hostname2.png
    79.5 KB · Views: 208
Upvote 0

BarrySumpter

Active Member
Licensed User
Longtime User
Hi WarWound,

Thanks for taking the time to reply.

adb devices
showes only the emulator and only one physical phone with that 0123... id

Thats the Device/phone/serial id from the script above.

As you wrote - not the 01234... adb number we're looking for. Darn it.

Setting | Applications | Development will allow editing the device host name at the bottom of the page.
Changed but no diff

update:
rebooted both phones and pugged them in with 10 second interval between.
ANd now both are showing in the adb devices

update2:
change the name back - rebooted - both are still showing in the adb devices.
But b4a still doesn't recognise both.

Just tested LC and LC DOES NOT recognize both either.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…