how to end a call programmatically in j2me? - java

i am developing an application that I need user phone number so I call the server from user's j2me application and I use platformRequest("tel:" + number); in my program for this purpose.
But the problem is that I don't know how I can abort the call because a minute ringing is sufficient for server to retrieving user number.
I want to know is there any API or instruction for canceling a call or some trick for it? for example is pushing the RED button programmatically possible in j2me?

No way to do this, best to get your server to terminate the call somehow.

Related

Scanning Wifi list on background

Problem
I'm making an app that can detect if current place is a particular place and play the sound if I'm locating in a particular place. So, I'm going to detect the place using wifi names(ssid).
Thus, I want to get ssid list when the app is running on background service. Also, it should always get ssid list because it plays sound when user reached the place.
Question
So my question is, How to always get ssid list and detect the place on background?
First, you should using a service to run a scan task, because of background limitation, my suggestion is foreground service, refer foreground-services
Second, about wifi scan feature, on Android, we can get a list of Wi-Fi access points that are visible from the device, but have few limitations apply to the frequency of scan, each background app (All background apps combined for android 9 and higher) can scan one time in a 30-minute period , and 2-minute period for foreground app.
please refer : wifi-scan-throttling

Receive and read GATT notifications on Android

So right now, I'm currently using the TI SensorTag and edited it such that it will send a GATT notification with some data every time I press one of the switches on the device and followed this code where moisture is the data I'm trying to send.
static void sendData(void )
{
int length=0;
while(moisture[length] != NULL)
{
length++;
}
attHandleValueNoti_t nData;
nData.len = length;
nData.handle = length;
osal_memcpy( &nData.value, &moisture, length );
// Send the Notification
GATT_Notification( 0, &nData, FALSE );
}
Now on the Java side, TI provided the SensorTag app source code so I'm editing that to receive the data and save it into a .txt file for later retrieval. I was able to get the app to create a new directory on startup if it does not exist and create the .txt file and populate it with random strings with the same button press as the one used to send the data. A quick question I had about this is should this be done or should I use separate buttons?
What I'm having a huge issue even understanding is how to read the incoming notification or data. From what I understand so far, you need to know the characteristic or something of the incoming notification to read it? I do have notifications enabled on my central device so I know that I have at least that covered. For this kind of data transfer, I don't need to use any UUID things, correct? And if I do, would I be able to piggyback on one of the existing sensor services to do so? Or perhaps use the test service?
I've read a decent amount on BLE communications but I just can't seem to get it. How do I read the incoming notification or data I sent from the SensorTag through BLE?
A quick question I had about this is should this be done or should I
use separate buttons?
It's totally your call. If I were you, I would stick on to one button since BLE devices are better if designed the most simplest way. KISS.
From what I understand so far, you need to know the characteristic or something of the incoming notification to read it?
Yes, you need the same profile running on both the peripheral and the central to enable notifications. In Bluez for example, run the bluetoothd daemon with all experimental profiles to communicate with a TI Sensor tag like this: bluetoothd -E . The same logic applies for a central running on Java. Reference: http://www.amazon.com/Inside-Bluetooth-Communications-Sensing-Library/dp/1608075796
For this kind of data transfer, I don't need to use any UUID things, correct?
No, you don't have to since you aren't creating a new service but rather using the moisture sensor service already available on the device.
I've read a decent amount on BLE communications but I just can't seem to get it.
To know more about Bluetooth terminology such as profiles, services, characteristics, asymmetric architecture, etc, please read the following references to understand the theory behind what's taking place:
http://www.amazon.com/Inside-Bluetooth-Communications-Sensing-Library/dp/1608075796 (use this if you are already into the technical details of the project)
http://www.amazon.com/Bluetooth-Low-Energy-Developers-Handbook/dp/013288836X/ref=pd_sim_14_1?ie=UTF8&refRID=13KZ3RZ0VW93CK91RCM3 (this gives a more general picture of the BLE)

find out location of phone based on received sms

I am creating a java application to receive messages on pc using jsms API. Whenever a user sends a particular message to a no, it receives it and adds to the database, the phone number and the area/ region where it belongs.
The region can either be the area where the phone number is registered, or it can also be the current location of the device. Either of these information will help me.
I would be really glad if any one could any one guide me on how to proceed with finding out the region using java code.
Note: I'm not looking for the country. I'm looking for the state/ region. Preferable Indian states.
You could try out libphonenumber. It basically defines the region based on the number.
There is a JavaScript try page here you could perform some tests.

How do I get the Arduino Nano to communicate with a phone through Java?

My goal: Make my phone control an Arduino which controls servos which will do cool animations.
How do I get to my goal: I use Java to communicate to the Arduino Nano through the yellow pins (visible on the right picture) through serial (RxD/TxD) (RS-232 protocol) which will tell the Arduino how to control the servos or motors.
Problems:
I don't know which one of the pins that does what, like which one that is GND, which one that is TxD or RxD
I don't know how to tell the phone to do things with its yellow pins (which the Arduino will read and understand to control its servos/motors)
[_] I don't know how to listen to the phone's accelerometer through Java - The thing that lets it tell what is down
[_] I don't know how to listen to the phone's light-sensor
[_] I don't know how to listen to the phone's microphone
[_] I don't know how to listen to the phone's camera
[_] = Things I'm just very curious about that I will use for future projects.
Extra information: I got NetBeans IDE 7.1.1, and I got an Arduino Nano, I got the phone shown above which is called "J10i2 Elm Sony Ericsson".
So I guess what I'm really looking for is someone who knows how to control a phone 100% through Java. Or being pointed in the right direction is also nice!
If you think that I can do this in a better/simpler/smarter way then feel free to leave a comment stating why and how it is better ;)
I would suggest one easy solution, use a REST web service (SOA arquitechture) to solve this problem i did it in my personal case and now im able to control and monitor my house :)
You could simply create a database table representation of your arduino's pins...then just create a service that receives some parameters (i.e> pin no, status -> 1/0, arduino id, etc) and saves them in the database, with your mobile app you could just use the same web service for changing the values.
Finally write down an Arduino app that keeps reading statuses from that service and database (of course using another endpoint/ method in which case you just need to pass your arduino id and it will return a response of all of the different pin status so you can read/process them from your arduino (for example since JSON library is heavy and slow on arduino im passing my return values back from the server to the arduino using simple CSV values i.e> "[pin:status,.....]" i have some code for making HTTP/GET/POST on Arduino you just need the ethernet shield , i could bring you the code if you are interested

How can you send the exact number of notification (the number next to your apps) to facebook instead of each time we make a request?

I'm trying to have more control on the number we have next to our apps for the user, How can we just send the exact number to show instead of sending notification that increment that number each time.
Basically the current behavior is :
Friend ask for something or give me a gift it increase the number
If another friend send me something its increase the number.
When I log to the game all the counter is reset.
Wanted behavior :
When I log to the game and i go see only one friend on the counter for this friend is reset.
We are currently using facebook-java-api but we will probably merge to restfb soon.
But if you know how to do it in any language it will probably help.
The old dashboard api support the set_count method that can reset to 0 or put the value you want for your apps.
See http://developers.facebook.com/docs/reference/rest/dashboard.setCount/
However the facebook-java-api don't support setCount but the newer restFB does so we need to update our apps to the new api.
EDIT: Note that you and extend the BasicClient and create a custom IFacebook Method with facebook-java-api it`s not clean but it do the trick utils we upgrade to a new facebook api.

Categories