BLE autoconnect

I am having a difficult time making an Android device connect automatically to a specific BLE device by name. I can connect to the device by scanning, selecting and connecting manually. Does anyone have a code to automatically connect to a named device on startup?