-1

I created a transmitter app with this Error code 2 in beacon transmitter for Android Beacon library code and able to transmit as iBeacon.

Problem 1: The app no longer able to transmit if i killed the app from recents(Should i call this from foreground service? Any in-built API from altbeacons library?)

Problem 2: I need to send a 10 character String to scanner after connection established, but setDataFields() only allowing for 6 digits.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Root
  • 3
  • 2
  • What device model and operating system version are you using? With respect to Problem 1, do you *ever* see it transmit successfully if you try transmitting after a reboot before killing the app? – davidgyoung Oct 30 '17 at 17:00
  • Moto G5 plus with Android N. It didn't started after reboot. Should I subclass application class and hold references of beacon classes even for transmission? Should I change manifest to make it autostart? – Root Oct 31 '17 at 03:31
  • Please give a clue for problem 2 as well. If I can't identify a particular device (beacon) with unique code, I can't get analytics of who's using the service. Bluetooth address is changing with every other connection, which means I can't use it for uniquely identifying a beacon. – Root Oct 31 '17 at 03:37
  • @davidgyoung can you help me with this? – Root Nov 01 '17 at 18:12

1 Answers1

0

It is a bit tricky to keep an Android app running in the background, which what you need to do to keep a transmitter going.

The Android Beacon Library does this automatically for scanning purposes, so you could use the library's reference app as a starting point and put the transmission start in the onCreate method of the Application class.

This would keep the transmitter going pretty much forever on Android 5-7. On Android 8 you are limited to running in the background for about 5 minutes out of every 15 unless you build a foreground service.

EDIT

If you wish to advertise several bytes of data, your best bet is to encode it in the 16 byte ID1 (ProximityUUID) field. You can reserve the first few bytes for determining if the beacon is yours, then use the last 10 bytes or so to encode your data. On the receiver side you can use identifier.getBytes() to convert your first identifier to a byte array so you can access data elements inside of it.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Thanks, problem 1 solved how about sending data from transmitter to scanner or vice versa(problem 2)? – Root Nov 02 '17 at 04:36