After following these instructions to integrate Adobe AIR with native Android I have a few issues.
I have managed to get a bluetooth connection going in native android, setting up 2 BluetoothSockets which then shows the air app also packaged within the apk. This included air app requires 2 connections to somewhere (normally wifi).
I have it connecting to TestService1 and TestService2, which is then passing the traffic between these services and the BluetoothSockets.
It is a little slow as i have to put Thread.sleep(80) in between reading from bt socket and writing to the AIR app for it to work currently.
My 2 questions are
Is there any way to get the AIR app to know about and access the Bluetooth Sockets created in the Android code rather than having the 2 Services being the middle men?
Is this kind of release (hybrid) allowed in Android Marketplace does anyone know?
Really hoping to find an answer to question 1 as currently my bluetooth server is continously sending data and using the TestService1 and 2 to get this bluetooth data to the AIR app and is causing a 10 seconds lag.
Thanks in advance
These apps are definitely allowed in the Android market.
You should be able to send Bluetooth data immediately over the socket to the AIR app. It doesn't seem like you should need 2 separate services or a sleep. I think your service that is talking to the Bluetooth can also listen on a socket and send data over that socket when it gets it.
Related
Here is the current scenario:
I have two(2) Android phones.
Android Phone 1 as the server phone.
Android Phone 2 as the client phone.
Here is what I want to do:
I want to create an Android-based app (E.g. Student Information app) where it will have basically two (2) modes:
Server - for adding, editing and deleting data on a local database.
Client - for viewing data from the database of the server.
The app will be installed to Android Phone 1 and set to Server mode.
The app will be installed to Android Phone 2 and set to Client mode.
I want to ask these questions:
I want to locally host the database of the Server app, so that Client app will be able to view the data. Is this possible?
If yes, how can I do it?
Note:
I am currently a web developer so I know that connected on the same network is a requirement.
I have implemented the same concept on a medium business where the web-based system is locally hosted so that computers on the same network can access it.
Suggest everything that you want to suggest, except the disadvantage of doing this concept. I am aware of some obvious disadvantages based from my research and willing to face the disadvantages provided that I will be able to implement the concept.
Rooting the phones is an option.
I want to accommodate small-sized business that is why I want to use Android phones rather than using Desktop Computers/Laptop.
I have read similar suggested questions here based on my title.
We have done the exact same thing in my company. The way we solved this is that the server exposes a service using the Android NSD API, so the clients (using the same API) can find it on the network. And after a client has connected to the server, the server sends its database file (yes, the .db file in /data/data/...) to the client via OutputStream. When the client receives the entire database and checks for its integrity, it copies it to its own /data/data/... and restarts part of the app.
Android NSD
I am working on an app that will act as a dashboard for an electronic card installed in cars and trucks.
I need the application to be able to receive data from this card, so I can display it in various ways on the app.
We chose Wifi for the communication method. To access the card, my app is able to connect to a Wifi network created by it.
I would like to receive JSON sent by the card every second.
I need help on where to start to make the two devices communicate, and what are the good practices on implementing this kind of communication.
The app basically act as a client, and the card as a server.
I found something about sockets, but it seemed to use two Android devices, a server and a client, so I'm kinda stuck here.
I use Android Studio 2.1.2 with the Android APIs ranging from 19 to latest.
One option is to broadcast with UDP the data within the local network. The moment the android device connects to the wifi network it will be in its local network. So the data can be received at the android end with a multicast receiver(check out http://jgroups.org/ ).
Refer example
It may also use the p2p sharing with TCP and bind the device with static IPs for communication. Create a simple socket receiver at the android end and a service at the device end. Depends on the way you choose it.
I have a very basic design of my entire application, where several users with my app on there android devices commits data to the server (I have used REST web services(java) + postgresql as my server) through HTTP post request from the android application. I am successful in achieving this and app runs absolutely fine. Now i want to implement a scenario where any change(CRUD operations) on my db on server should create a notification on my users android device. How should i achieve this with my server design unchanged? I have looked into Google Cloud Messaging, but could figure out the server implementation.
For now i have implemented db triggers on postgresql and able to get control back into java code using Notify/Listen feature of postgresql. From here i need to connect to android device. How can this be achieved. Is Google Cloud Messaging the only way? I have not seen any insert/update statements in there server implementation. Could anyone please guide me on this?
either you can use GCM or implement a Socket at server end and open a socket connection from mobile but this approach may add some additional processing overhead because it will create a daemon thread to listen socket port from mobile device.
You should use native library (NotificationManager etc.), here you can find a great tutorial.
My Advice is for you to use GCM. GCM normally takes a maximum of 4kb, so you could have your own defined "commands". You could use them to determine the requests on both ends, ie on android app and the server end. A php script on the server would help you in this.
I am working on an app where by the android app sends messages to the server via POST and the server forwards the message to the appropriate user via GCM. In my case I have very many things to share so in that case I am using commands, for example if it is a new incoming message I send a GCM to the app with one variable as the command and the rest as the data. On the android app I use the command variable to determine what to do with the data.
Kindly avoid that socket advice, it will have your app drain the battery to sustain the open socket , besides you don't have to re-invent the wheel while Google servers already has it
i am developing an APP in Android which share screen to all android mobile phone connected in a session.
i want to know that android provides any sdk which provides same service like desktop to dektop access as in team View ?
or any Idea, which SDK i have to used?
Thank you.
Smartphones can't directly connect to each others since they are running in different networks. The common way to solve this is an additional server component. All phones need to connect to the server and send their data. The server is pushing this data to other connected clients, probably by using push notifications. In Android Push Notifications are known as C2DM.
Android developers blog:
http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html
Here's another tutorial on the topic:
http://www.zylinc.com/blog-reader/items/c2dm-a-simple-introduction-using-a-java-server.html
I like 2X RDP a lot. It works very well on phone and tablet and connects to the regular Windows RDP server, so don’t have to install anything else on the server machine.
I am running a multi thread application on android and adobe air, in native android 2 bluetooth sockets are set up and a couple of server threads for the air app to communicate with the bluetooth sockets of native android. It's basically socket programming and it all works on one device I used to programme it.
The device i used to develop this app was slow, i therefore got myself another tablet to test (android vega) and it is very fast at communicating my bluetooth data as it has 2.1edr version.
The problem is with the Advent Vega tablet the bluetooth streams just disconnect for no apparent reason intermittently and in the adb log window i just get trying to connect to device all of a sudden when the disconnect occurs, i have no mention of the crash anywhere in the log, this happens to both bluetooth connected threads at the same time so it must be something to do with the bluetooth radio im suspecting. The other tablet device runs the app fine but slower (no disconnects). I have even installed a custom 3.0 rom on the vega to see if it was a os problem but the disconnect problem persisted on 3.0 as well.
Due to the fact there is no mention of this in the adb log i am just basically staring at a screen with no idea of why it disconnects for 2 days now!! The only way to get the app to run again after this disconnection occurs is to restart the bluetooth on the device but this disconnect occurs again eventually when next run. It seems to improve the amount of time it stays alive tansferring data when the app is first run afater a re boot.
I have gone through all code of the run() and stopping() of each thread and it seems to exit gracefully, i close the bluetooth sockets only, it seems from research no need to close the bluetooth input and output but i have also tried that approach to closing.
Can anyone offer suggestions as to why both bluetooth read/write loops would just stop all of a sudden and disconnect? Seemingly effecting the adb log as well as it just says trying to connect...
Or any suggestions as to how to better debug when this occurs?
Or even what somebody else would do in this situation.
Hope someone can help, i have a great phone remote app for the android tablet owner community and it hinges on this final issue which i have been stuck on for 2 days.
I had problems with disconnects, and implemented a keepalive by sending a ping request and a ping ack.
This worked fine for me...