Saturday 6 July 2013

How to add View to android service ?

Generally Android service do not have view

Android Service can be explained as -

Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application.

But If you want to add some UI to the service , then you can use WindowManage for this purpose.
Suppose you want to add Imageview to the android application, Then following code serves the purpose.


ImageView imageView = new ImageView(this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
    PixelFormat.TRANSLUCENT);
  params.gravity = Gravity.LEFT | Gravity.BOTTOM;
  params.setTitle("Any Title");
  WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);

   wm.addView(imageView, params);
  imageView.setBackgroundResource(R.drawable.idofimageresource);



copy this code in the onCreate()  function of the service.
You can experiment different layout params and found out what is useful for your.

Wednesday 3 April 2013

Official Upgrade for Samsung Galaxy pop S5570 from Android 2.2 to android 2.3

Galaxy pop is one of early Android smartphone of Samsung. Galaxy pop has android 2.2 (Froyo) as default OS. However, you can upgrade your  galaxy pop to Android 2.3 i..e very  easily.


Note : Before upgrading your smartphone, Kindly remove your sdcard ,sim card and take backup of your contacts and other important data. Make sure that your phone battery is fully charged. The process should not be interrupted in between. 

Steps to upgrade your galaxy pop from froyo to gingerbread are as follows.

Step 1: Install  samsung kies to your laptop/pc
Step 2: Connect your Galaxy pop with laptop using USB cable. Now open kies, and wait till your device is detected.

Step 3: Go to Tools menu, Click on  "Firmware Upgrade and initialisation" option.

Step 4: Now click on available update.... it would take around 15-45 minutes depending upon your machine and internet connection speed.

Step 5: Reboot your device after upgrading process is successfully completed.


Check "About phone" option in settings menu !
Congratulation ! you have Android 2.3 in your Galaxy pop.

Monday 25 March 2013

How to use Whatsapp without changing LAST SEEN time !!



Hello Friends, Whatsapp is nowadays very popular medium for communication.
It is very handy and easy to use. It has very Great feature called Last Seen.  This feature enables user to see that when his/her friend used the Whatsapp last time.

So, Sometimes It may happen that  you wish to Use Whatsapp but you don't want that your Friend come to know about your last whatsapp access time right?
Reason Can be anything ;-)

[ For this Trick , Whole credit Goes to my friend Manas Vaishnav ]

Basic Rule is - Don't Open Whatsapp while your Data connection/Internet connection is ON.

Scenario :

In normal condition you data connection is enable.
you will receive whatsapp notifications when someone messages you.
now disable your data connection.
open whatsapp... read message... if you want to reply then type your message and press send button
Now close Whatsapp,
enable data connection !

Done...
You have read your message, replied to your friend yet your Last Seen Time will not changed !




"Relationship now a days begins with 'First seen' at Facebook & Ends after noticing 'Last seen' on Whatsapp !" - Manas Vaishnav

Thursday 21 March 2013

Mouse Programming in C

This is simple tutorial to show you How you can  use Mouse  in your C program.
I have Attached a source file. This program is not developed by me. I found it on internet somewhere, But as this program is easy to understand I am using this program.

See Source code here.


To Enable Mouse in C program you need to generate Interrupt.
The interrupt number for Mouse input related service is 33h.



Files to include -> dos.h
Function from dos.h to be use ->int int86(int intno,union REGS *input , union Regs *output)
This Function Generates Software interrupts

union - REGS is defined in dos.h file
it is defined as

union REGS{
struct WORDREGS   x;
struct BYTEREGS     y;
};

WORDREGS  & BYTEREGS are defined as

struct WORDREGS{
unsigned int ax,bx,cx,dx;
unsigned int si,di,cflag,flags;
};

struct BYTEREGS{
unsigned int al,ah,bl,bh;
unsigned int cl,ch,dl,dh;
};


You don't need to remember all this stuff. This is just for understanding.
If you have studied any  Micro Controller subject then you can easily identify that these ax,bx... indicates Registers.

So, let me first tell  what we exactly gonna do.

For every type of event there are Software interrupt number are defined.
for example using keyboard, sound, mouse.
Here for mouse interrupt number is 33h.
and for all types of operation like show mouse pointer, initialize mouse, restrict mouse pointer on screen etc.. we have different Service numbers.

Generally service number will be provided in
ax register,
so here we will write something like  i.x.ax

now all the input information will be provided in   variable of type REGS, and we will get out put in similar union varible

In our program we have declared
union i,o;
we will use
 i as input 
o as output, 

so this are some of service numbers for mouse



0~ Mouse Reset/Get Mouse Installed Flag
1~ Show Mouse Cursor
2~ Hide Mouse Cursor
3~ Get Mouse Position and Button Status
4~ Set Mouse Cursor Position
5~ Get Mouse Button Press Information
6~ Get Mouse Button Release Information
7~ Set Mouse Horizontal Min/Max Position
8~ Set Mouse Vertical Min/Max Position

This is example who you  can use this  service.

To initialize mouse

i.x.ax=0;
int86(33h,&i,&o);

done !!


to Restrict mouse pointer between square (10,10) to (20,20)

        i.x.ax=7;
 i.x.cx=10;
 i.x.dx=20;
 int86(0x33,&i,&o);

 i.x.ax=8;
 i.x.cx=10;
 i.x.dx=20;
 int86(0x33,&i,&o);

very simple right?
now Go through source code and  try your self.

Tuesday 19 March 2013

Hide files in Image


This is very popular and old trick to hide any kind of file in image ! But it is very effective :)
I have written this blog assuming that reader is novice to command prompt and all.

So Here are the steps :

Step 1. 
put all files that you want to hide in one folder.
compress that folder using winrar, winzip or 7-zip whatever you like.
If you want to hide only one file then you can directly compress it without putting it in to the folder.

Step 2.
Now make sure that your jpeg image (the one that you want to use) and compressed file (your data) are in same folder (Just to make process simpler.)

Step 3. 

open Command prompt
[click on start menu, open "Run" , type - cmd  , click ok ]


Step 4.
Open path of your image and compressed folder in command prompt.

Example:
suppose your command prompts shows
c:\abc\def>
and your image and compressed files are in  E:\new folder
then   type following commands
E:         hit enter
cd new hit enter

Step 5.
this is last step
type following command
suppose your image is  -  abc.jpg
compressed file is         -  xyz.rar

copy /b  abc.jpg+xyz.rar  pqr.jpg     hit enter

Done !!  now open pqr.jpg file.... it is image which contains your data !!
you can send to the person who know  how to retrieve data from it


Steps to retrieve data from Image :

Again open Command prompt
Go to path where your encrypted image is saved.

type following command

Rename pqr.jpg   data.rar

now your image will be changed to compressed file data.rar
extract this data.rar  and you will get your data !

Monday 18 March 2013

Facebook Chat Emoticons (Smilies) and Ascii art

Hello Friends, Facebook is now tightly bounded with our day to day life .  Facebook chat box is one of most frequently used medium of communication right? So  here,  Emoticons comes in to picture.
Emoticons (Smiles) makes conversation live and meaningful. Besides that it is fun ☺.

I am crazy after such Emoticons. I love to learn new Emoticons. So here, I will show you several  the ways to insert Emotions in the Facebook chat or comments.

Simple Emoticons :



Advance Emoticons:
type the code and hit enter. you will get image which is given below each code !!!



Ascii Symbols :

some of the Ascii Symbols are very useful.
For example :☺ ☻ ♥ ♦ ♣ ♠ ♦

To use such symbols , Press Alt key and while pressing Alt key press any number from Numpad. then release Alt key.

example :
to print ☺
hold alt key ,press 1 in num pad then release alt key. thats it..
and beauty of this Ascii symbols is that you can use this symbols anywhere in any editor. ☺. 

Reference table :
Ignore Hex code... use Decimal code. 




If you know any other way. let me know , I will add in this blog  ♥
Happy chatting ;-)