Tuesday, July 7, 2020

Authentication Boiler Plate

Authentication Boiler Plate design code. Register Users, Login and Logout.

Client : React JS
Server : Node JS
Database: MongoDB

https://github.com/hemtri1984/auth_boilerplate

Thursday, January 9, 2020

Wednesday, September 30, 2015

MVP Architecture Design

High Level Architecture:




Business Logic Architecture :





Class Diagram :



Tuesday, September 1, 2015

WeatherAppWidgetApplication


It's a new idea in the market to find the weather forecast of any location in the world on your fingertips.

Playstore link of application :



Description:
This application is a weather details and forecast application. It's a very user friendly application. When user opens the application, initially it show the user current location weather details over the map. If your want to see weather details of any other location, user needs to touch that location on the map.
Clicking on snippet navigates the user to weather hourly weather details, temp, weather etc etc. And clicking on weather details windows takes the user to weather details screen, where user can see the complete details of today's weather, wind speed, upper and lower temp along with user can see the weather forecast of full week.


Key Point : 
1 - Weather details shown in the map.
2 - Highly interactive UI.
3 - User can use it as an application widget on home screen.


Upcoming Features:
  • Search bar on map to search any location.
  • Location details of whats app / FB Share.
  • Flexiblity to disable map snippet, so user can point out nearby location.
  • Complatibility for Tablets and Wears.
  • More stable and user interactive.






Sunday, July 1, 2012

Twitter Integration with Mobile Application

While integrating our mobile application with Twitter, I want to share the steps.

1 - Create you application in Twitter developer page using the mentioned link : https://dev.twitter.com/apps/new

2 - Fill all the details mentioned in the Twitter new application page, and create a new app.

3 - Now, Once your application will create, it will give you these information.
  • Consumer key
  • Consumer secret
  • Access token
  • Access token secret

Now, there are two ways to integrate Twitter with your mobile.
a - Single User Implementation :
This works only for a single user. It means, only one user will register with the application, and every time when user want to post any data in Twitter, it will post only to his/her Twitter page.
This can be achieved by this way :

//Get authorization to twitter.
Credential credentials = new Credential(consumerKey, consumerSecret, accessToken);

//Create account manager for tweet the post.
UserAccountManager accManager = UserAccountManager.getInstance(credentials);

//Verify credentials and post to twitter
try {
                    if(accManager.verifyCredential()) {
                        Dialog.alert("Authenticated");
                        //post data to Twitter

                    }else{
                        Dialog.alert("Authentication Failed");
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    System.out.println("IOException Occured: "+e.getMessage());
                    e.printStackTrace();
                } catch (LimitExceededException e) {
                    // TODO Auto-generated catch block
                    System.out.println("LimitExceededException Occured: "+e.getMessage());
                    e.printStackTrace();
                }


b - Multiple User Implementation :
This works for multiple user. Any user can enter his username and password, and post data to his/her twitter profile.
For this, first our application should be authorized by Twitter. To do this, we need to send an Authorization mail to api@twitter.com. Once, the application will authorize, you will get a confirmation mail.

Now, to share your post to Twitter, do this :

                Credential credentials = new Credential("username or email", "password", "consumerKey", "consumerSecret");
                UserAccountManager accManager = UserAccountManager.getInstance(credentials);
           
                //If your application is authenticated then it returns token value, else return null.
                Token token = accManager.getAccessToken();
               
                try {
                    if(accManager.verifyCredential()) {
                        Dialog.alert("Authenticated");
                        //post data to Twitter

                    }else{
                        Dialog.alert("Authentication Failed");
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    System.out.println("IOException Occured: "+e.getMessage());
                    e.printStackTrace();
                } catch (LimitExceededException e) {
                    // TODO Auto-generated catch block
                    System.out.println("LimitExceededException Occured: "+e.getMessage());
                    e.printStackTrace();
                }


- Here cunsumerKey and consumerSecret are reference to the application. And token is reference to authorized user. If your application is not authorized, application will throw Http 401 error (Unauthorized Exception).

Retrieve cell id for location, sign it for S40

How to retrieve cell id :

Here is the code to retrieve cell id, to know your location :

getCellId() {
//for s40 series
id = System.getProperty("Cell-ID");
//for s60 series
id = System.getProperty("com.nokia.mid.cellid");
}

This code will works only for s40 3rd edition fp1, and s60 3rd edition fp2.
for s60 fp2 devices, it shows you easily the cell id of device to know your location. But for s40 FP1, it gives you null value. To get the cell id, we need a certification for it.