Getting device characteristics and network information - java

I am developing a context aware mobile application. I need to have information about the capabilities of terminal devices and network characteristics such as current bandwidth. My question is, are there APIs in android to access this information?
Thanks.

The better question is, are there APIs for these terminal devices to access the information from outside. Of course you can get the bandwidth of your phone to the provider, but to get that info of the terminal device, you need to access their data.
I would suggest a three-way request for that. At first there is a webservice, in your language of choice, e.x. PHP, which has to get access to the terminal device. That device has to publish their data somehow, so thats the first point you need to know.
Then this webservice cleans the data like you need it and publish it as xml or json or whatever.
Then your App in Android acceess the service to get the info and parse it into your app.
There are alot posts here to find out, how to get a HTTP Request Result. For parsing XML you can find something here:
http://www.ibm.com/developerworks/opensource/library/x-android/index.html
For accessing a network device with a specific port an such stuff, you can use PHP with the function fsockopen()

Related

How to make Android app wait for a message from Python on a local server without internet?

Sorry if this is a silly question, I'm still a beginner in Android and couldn't find an answer to my question. I'm making an Android application that sends an input to a server and executes a Python script on that server to process the given input and generates an output. I was successful in sending data from Android client to Python server using SSH.
I can also use SSH to retrieve the output back to the Android client. However, the Python script takes some time to generate the output, and I can't seem to find a way for the Android client to wait for the Python script to finish generating the output. I was able to do this on internet connection with using Firebase database and have the Python script upload the output into Firebase database and have the Android client listen for changes in database. But I'm looking for a way to do this locally without internet (i.e. Firebase).
So is there a way to make my Android application wait for a message from Python to know it has finished with generating the output so it can retrieve it back using SSH or any other way?
Was a protocol what was send a code what was suppost to say if that 2 files are the same. but i do not remember the name. For u will be more easy to send the storage information's in bits (to the device) and after to start that important transfer. when the device will lost the connection will need to compare the real storage memory with the first information's send it and if has not match to ask the user to reconnect to internet or something like that. Maybe is helping until some one will give u the answer.

How to handle deleted app device token in Pushwoosh?

I am using Pushwoosh for sending notifications to Android and iOS apps from Java Webservices. I found it very easy to use.
I have successfully implemented it. I am using createMessage method with multiple device tokens for sending notifications.
I have used it for many times, and was getting proper response. But after some time I'm getting some device tokens in UnknownDevices key in a response. It is because some devices have deleted the app.
So is there any way that I can handle this situation that not sending notifications to devices which have deleted the app? How can I know that device has deleted the app?
Does Pushwoosh blocks account if I keep sending notifications to devices which has deleted the app?
Thanks
There are two ways of handling this:
Send pushes via Tags feature, where you set Tags on the device with the setTags method, not with push tokens. We will remove invalid/expired tokens for you.
You can use getUnregisteredDevices method, which is currently not documented publicly, but the Support team can provide details. the only disadvantage of this method is that it does not return iOS tokens handled by Apple feedback Service.

Java Server for Android Application

I need to write a server in java that will store integers that are used as stats for my android app. My app has an SQLite database that is already setup that would be useful if I could just pass those contents to the server. I need to do this so that in my multiplayer feature, a player's app will contact the server to know what level their opponent is. (This is not real time). So far I only have a TCP server that opens a client and server socket. Other than that I am not positive what I need to do to make it possible for the server to do what I need. Anyone have suggestions or good tutorials to help me with my problem?
Thanks.
One thing you need to keep track of:
Your SQLite DB has to be used as a player session, until the player logs in as another user. To do this, you have to have one instance of the current logged in player. If you prefer other methods, here's a good list.
I don't think you would need a TCP connection to view the stats, instead implement a REST API in PHP or any other language for back-end that would save, update and look up for a particular player. This is a recommended method. If you are familiar with PHP, this tutorial will give you an idea and full details of what I mean.
Indeed, building a server has many methods. For example, You can use either socket programming or app-server. If you are familiar with web programming, jsp/php/asp.net, you can communicate between your app and server with HTTP requset, which is easy to do.
To be more specific, someone (neme:abc,password:pwd) logging in with your mutiplayer app, when he or she leaves, send the data to server with HTTP request. Then when he or she logging in with other device, you can get the data from status and continues to play. Of course, you can save the data in local with SharedPrefence in Android, too.
By the way, the apache HTTPClient is recommend when using http connection with server.

android application and communication with asterisk server

I am trying to develop an application voip android drawing mainly from the famous application "CSipSimple" and in addition to sending and receiving audio and video call I'll try to draw the position of a client using ip address :the information of geo locations identified from smart phone will be forwarded to the Asterisk server then he charge to store it in its MySQL database.) and therefore access to the asterisk 's console from the device and then those informations of geolocation will be recovered at the request of a customer. Please quelque'un can help me with links or ideas to start I will be really grateful. thank you in advance
What is your blocking problem here?
-For SIP audio/video use CSipSimple.
-From Asterisk, just store the caller/called party IP with the CDR into your database.
-For GeoIP you can use your own database (these kind of tables can be downloaded from various sources) or you can use a service (there are a few xml or json based services providing these info).
-For the display you can use google map (some javascript code will be needed)

Monitor Internet activity

I want to desing java application that montior internet activity. Let consider I open different browser and that sending and receving data from internet. My application requirment is that to monitor that sending and receving packets. So my application working as services that generate log of internet surfing. How this posible in the java?
Try jNetPcap. The site is full of examples and tutorials.
There are a few things you can do. If your end goal is to simply monitor the traffic, use an existing application like Ethereal or Wireshark.
Otherwise, if you want to write your own application, have a look the the Jpcap and/or JNetPcap libraries. They allow you to bind to network interfaces and sniff / analyse all the packets that pass through those interfaces.

Categories

Resources