Android Question Get AdvertisingID

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.

I follow the instruction about how to set AdvertisingID from this URL https://www.b4x.com/android/forum/threads/advertising-id.101050/#content and it works fine.

But only if I put this code into main activity as Erel said.

My question is - is it possible to move it to the class and call it from different places? For example I need it to be called from Starter service and then pass this AdvertisingID to the FirebaseMessages service as a ticket ID.

I tried to create a small project but when I compile it I'm getting an error

B4X: Copy
B4A Version: 10.0
Java Version: 8
Parsing code.    (0.00s)
Building folders structure.    (0.01s)
Compiling code.    (0.01s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Generating R file.    (0.27s)
Compiling debugger engine code.    (0.51s)
Compiling generated Java code.    Error
B4A line: 50
End Sub
javac 1.8.0_40
src\alex\Advertisingid\clsdeviceid.java:247: error: cannot find symbol
   BA.runAsync(processBA, mostCurrent, "advertisingid_ready", new Object[] {false, ""}
               ^
  symbol:   variable processBA
  location: class clsdeviceid

What am I doing wrong?
 

Attachments

Back
Top