Click here to Skip to main content
15,867,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I plan to send data whit Bluetooth in android programming.
I want the connection to the device Receiver Bluetooth if my application is not running the program launch and successful connection happen.
I ran it through the service, but my code does not work.

public void handleMessage(Message msg)
	    	{
	    		
	    		switch(msg.what)
	    		{
	    		case DATA_STATE_CHANGE:
	    			switch(msg.arg1)
	    			{
	    			
	    			case BluetoothConnect.STATE_LISTEN:
	    			    Intent startActivit=new Intent(MyService.this,BluetoothTransferActivity.class);
	    				startActivit.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	    				startActivity(startActivit);
	    				break;
	    				
	    			
	    			}
	    			break;
	    		
	    			}}};

And I got a call obtainmessage

Is there a problem running a service?
Posted
Comments
Sandeep Londhe 8-Sep-14 15:50pm    
is there any logcat error is showing?
Member 10496892 24-Sep-14 1:57am    
no:(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900