Saturday, February 22, 2014

Sending Message from PC through mobile using AT Commands over Bluetooth

AT Commands:
              AT or attention are set of commands those are used to communicate with GSM modems.I am not going much about it as you can google it.I tried using the AT commands through Bluetooth  which was successful and finally integrated it to JAVA so that I can send message through my mobile using an interface instead of hyper-terminal.Before getting it started check your mobile if it supports the commands or not by using Hyper-terminal or any serial port Software.

               In the below codes i have used RxTx serial communication library that is free to use and my communication port was 'COM9' please check it for you and then changing it compile the code. //Main GUI

package com.oksbwn.Y2014.Message_Mobile;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import javax.swing.*;

Saturday, February 8, 2014

Getting Facebook Access Token for JAVA applications

    When for the first time i used facebook API in my java application using the  library restFb i faced real trouble with the access token .For that i browsed a lot to get the token at last i was able.So to make it easy here are the steps to get the access token that is valid for 2 months.

   First of all create a facebook application and goto the application page.goto tools and click on APIExplorer   in the menu as shown below select your application...

Storing configuration data for JAVA applications

       Many times it is required to store some configuration settings for your application so that it can use again and again from where it left.Or the application can start with some specific parameters.So the properties file can come handy in such requirements.

   First lets write something to the properties file..

import java.util.Properties;

public class App {
  public static void main(String[] args) {

    Properties prop = new Properties();
    OutputStream output = null;

    try {

        output = new FileOutputStream("C:\\Alberto\\Config\\");
        prop.setProperty("mail", "");

Controlling VLC media player using JAVA

         Basically i was looking for a method to communicate with the VLC media player so that i can get the currently playing video on the player and my app can search the internet and get the details about the movie.For that i googled a lot and finally came to know that VLC has a web interface and i used that with my JAVA app to control and getting details of the movie.
        First open the VLC and goto tools->preferences and check the All radio button. and navigate to the Main Interface and click on lua and there you have to set HTTP password (Otherwise u cannot access the web interface). Screenshot is given below.


Friday, February 7, 2014

Sending Email using JAVA mail API and gmail account

        Sending a mail using JAVA mail API in JAVA is really a easy part.Here i am posting the codes to simply send a mail using the API.First you have to download the JAVA mail library and add it to your build path.

Tuesday, February 4, 2014

Show movie details using JAVA

   In this post i am going to post about using the API to search for a movie online and display the results like a gallery as shown above using provides a good API which actually provides all data associated with a movie  in JSON or XML format.I have used the XML format.Here are the codes...

Code to search online:

import javax.xml.parsers.DocumentBuilder;