Dim DeviceID1 As PhoneId
Dim DevID As String
DevID = DeviceID1.GetDeviceId
If DevID = "" Then
Dim Device As Phone
DevID = Device.GetSettings("android_id")
End If
And... don't forget to to put a checkmark in the correct phone library in the Libs tab of the B4A editor. I can't tell you exactly which one, I'm not at my dev pc right now. If there is a lib called PhoneId, use it, otherwise use the standard Phone lib. You'll know you got the right one when you start typing 'As PhoneId' and PhoneId is in the popup list if available objects.
No, B4A does that for you. The library's author is responsible for instructing B4A which permissions each of their objects use, and its all handled behind the scenes at compile time. Note that a library can have multiple objects, and unless I am mistaken, only the Dimmed objects will cause permissions to be reported.