IntentService lost work in executor - android

I have a classe for download files by an executor :
this.getFreshGoolgletoken(new CallBackTokenRefresh() {
#Override
public void getFreshGoogleToken(String token,String userEmail) {
ArrayList<ExecuteSynchroneRequest> mesRequetes = new ArrayList<>();
Intent mServiceIntent = new Intent(context, TraitementPermisLoaded.class);
for (CollectionPermis permis : collectionPermis){
// stocker les permis + les s3Key
int revision = permis.revision;
final String uuid = permis.uuid;
Log.i(LOG_TAG,"synchro OnLoop permis num & revision :"+uuid+"/"+revision);
Map<String,String> params = new HashMap<>();
params.put("uuid",uuid);
params.put("revision",String.valueOf(revision));
mesRequetes.add(new ExecuteSynchroneRequest(AwsEworkPermitsRoutes.PERMITS,params,context,token,apiClient,uuid,handler,mServiceIntent,callBack));
}
ExecutorService execute = Executors.newSingleThreadExecutor();
for(Runnable r : mesRequetes){
execute.execute(r);
}
execute.shutdown();
}
In this methode i have an IntentService(mServiceIntent) for handle a long treatement on my download. My executor class handle intentService like this in switch command :
case PERMITS:
if(mServiceIntent == null) break;
mServiceIntent.setData(Uri.parse(responseData));
mServiceIntent.putExtra("myHandler", new Messenger(handler));
mServiceIntent.putExtra("ptUuid", uuid);
context.startService(mServiceIntent);
break;
mServiceIntent Class is :
public class TraitementPermisLoaded extends IntentService {
static final String LOG_TAG = "ewp-executor ";
SharedPreferences sharedPreferences;
Handler handler;
public TraitementPermisLoaded() {
super("TraitementPermisLoaded");
setIntentRedelivery(true);
Log.i(LOG_TAG," service traitement permis called 2 ");
}
#Override
protected void onHandleIntent(Intent workIntent) {
this.sharedPreferences = getApplicationContext().getSharedPreferences("DATA", Context.MODE_PRIVATE);
// Gets data from the incoming Intent
String responseData = workIntent.getDataString();
Messenger messenger = null;
String ptUuid = "";
Bundle extras=workIntent.getExtras();
if (extras!=null) {
messenger=(Messenger)extras.get("myHandler");
ptUuid = extras.getString("ptUuid");
}
String permisUuid = "";
PtWrapper pt = null;
try {
ObjectMapper mapper = new ObjectMapper();
pt = mapper.readValue(responseData, PtWrapper.class);
HandleJson handleJson = HandleJson.getInstance(getApplicationContext());
permisUuid = pt.getPermisTravailFormContext().permisTravail.uuid;
if (permisUuid != null) {
handleJson.writeInInterneFileSysteme(sharedPreferences.getString("email",null),pt, permisUuid);
} else {
throw new HandleJsonNoPermisException("le UUID est null on ne peut pas enregistrer ce permis");
}
handleJson.setKpi(pt);
Message message = Message.obtain();
Bundle bundle= new Bundle();
bundle.putString("myevent", "un permis ok");
message.setData(bundle);
messenger.send(message);
} catch (IOException e) {
Log.i(LOG_TAG, e.getMessage());
e.printStackTrace();
Message message = Message.obtain();
Bundle bundle= new Bundle();
bundle.putString("error", ErrorsCodes.CODE_40.toString()+" / permit uuid : "+ptUuid);
message.setData(bundle);
try {
messenger.send(message);
} catch (RemoteException e1) {
e1.printStackTrace();
Log.i(LOG_TAG,"erreur messager : "+e1.getMessage());
}
} catch (HandleJsonNoPermisException e) {
Log.i(LOG_TAG, e.getMessage());
e.printStackTrace();
} catch (RemoteException e) {
Log.i(LOG_TAG,e.getMessage());
e.printStackTrace();
}catch(Exception e){
Log.i(LOG_TAG,e.getMessage());
e.printStackTrace();
}
}
}
I load 27 files but only 14 get a treatment, the Intentservice stop to work, it'seems to be after activity change but not sure. After loaded files, I change my activity by another, but intentService get all request in the queue. I have use IntentService because it will finish working all process before stopping?
What did I do wrong?
Thanks

the error source is the size of data in myService.setData(mydata>250ko). For all data more than 250 ko the service stop with this error message :
A/ActivityManager: Service done with onDestroy, but executeNesting=2:
ServiceRecord{5c8e958 u0
com.alit.aws.android.eworkpermit/.lib.TraitementPermisLoaded
There is another way to pass large data more than 250 k to my intentService ? I have tried :
->mServiceIntent.setData(Uri.parse(responseData));
->mServiceIntent.putExtra("myData",responseData);

I have found a solution, remove the "setData(responseData)" and replace it by a globalHasMap. After the end of treatment I remove item in hashMap.
May be it's not awesome but i have not found a better solution.
If someone can show me a better way, do it ;-)
Thanks

Related

HandleMessage Failed to Pass Object

I'm receiving data through a Bluetooth Service and would like to pass it to MainActivity with handleMessage, MainActivity has received the message but the object was "null"...Can anyone advise? Thanks in advance!
In Bluetooth Service: (the variable data is a String.)
mHandler.obtainMessage(MainActivity.MessageConstants.MESSAGE_ADD_ENTRY_L, data).sendToTarget();
In MainActivity:
problem- String data here is null, while I have double checked the data sent from bluetooth service is not null.
D/Main Activity: data at handler: null
mHandler = new Handler() {
#Override
public void handleMessage(#NonNull final Message msg) {
switch ((msg.what)) {
case MessageConstants.MESSAGE_ADD_ENTRY_L:
try {
Log.d(TAG, "handler add entry");
Thread dataParseThread = new Thread(new Runnable() {
#Override
public void run() {
String data = (String) msg.obj;
Log.d(TAG, "data at handler: " + data);
SensorData.parseDataL(data))
exportData.logEntryL();
}
});
dataParseThread.start();
} catch (Exception e) {
Log.d(TAG, "handler went wrong: " + e);
}
break;
}
}
};
While using sendToTarget() make sure your target is pointing to your mHandler as in
Message message = new Message();
message.what = MainActivity.MessageConstants.MESSAGE_ADD_ENTRY_L;
message.setData(data);
message.setTarget(mHandler);
message.sendToTarget();
UPDATE
you can still use your existing approach to get data as Object, but at some point you need to set the Target to Message so it can post
Message message = mHandler.obtainMessage(MainActivity.MessageConstants.MESSAGE_ADD_ENTRY_L, data);
message.setTarget(mHandler);
message.sendToTarget();

Android wifi: handler msg not working

I would like to ask a question about my code in Wifi client communication. I am communicating with a Raspberry Pi as server.
The architecture of my code is:
Main Activity: I have the Handler class and I launch in the OnCreat the first Thread (Thread1) that takes care of establishing the wifi connection.
public class MainActivity extends AppCompatActivity {
public int serverPort = 40000;
public String serverIP = "10.177.86.212";
public WiFiConnector wifiConnection;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editTextWE = (EditText) findViewById(R.id.editText_WE);
wifiConnection = new WiFiConnector(serverIP, serverPort);
Handler mHandler = new MyHandler();
WiFiConnector.Thread1 = new Thread(new WiFiConnector.Thread1(mHandler,true));
WiFiConnector.Thread1.start();
}
private class MyHandler extends Handler {
private byte[] bytes = null;
#Override
public void handleMessage(Message msg) {
bytes = msg.getData().getByteArray("KEY");
if(bytes!= null){
for (int i = 0; i < bytes.length; i++){
Log.d("Data received", "value " + (0xFF & bytes[i]) );
}
for (int i=0; i<bytes.length; i++) {
editTextWE.setText(editTextWE.getText()+ "Server says: " + bytes.length + " "+ (0xFF & bytes[i]) + "\n");
}
}
}
}
}
WifiConnector class: Thread1 and Thread2 are sharing the handler coming from the Main Activity. Thread1 send a command to Raspberry Pi to let it start sending data. Thread2 is dedicated to read data received from the server.
public class WiFiConnector {
static String serverIP;
static int serverPort;
public static Thread Thread1 = null;
//Constructor
public WiFiConnector(String IP, int port) {
serverIP = IP;
serverPort = port;
}
public static class Thread1 extends Thread implements Runnable {
private Handler handler1;
boolean firsttime = false;
OutputStream out ;
public Thread1(Handler handler_1, boolean firsttime) {
this.handler1 = handler_1;
this.firsttime = firsttime;
}
public void run() {
Socket socket = null;
try {
//Writing to a Socket
InetAddress serverAddress = InetAddress.getByName(serverIP);
socket = new Socket(serverAddress, serverPort);
out = new DataOutputStream(socket.getOutputStream());
if(firsttime){
//I send "B" to Raspberry to let him start sending data
out.write("B".getBytes());
this.fisrttime = false;
}
Thread2 comThread = new Thread2(socket, handler1);
new Thread(comThread).start();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static class Thread2 implements Runnable {
public Socket clientSocket;
private Handler handler_2;
public DataInputStream in;
public byte[] bytes = new byte[13];
public Message msg;
public Thread2(Socket clientSocket, Handler handler2) {
this.clientSocket = clientSocket;
this.handler_2 = handler2;
}
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
if (Looper.myLooper() == null) {
Looper.prepare();
}
this.in = new DataInputStream(clientSocket.getInputStream());
in.readFully(bytes);
if (in != null) {
for (int i = 0; i < bytes.length; i++){
Log.d("Data received", "valuewifi " + (0xFF & bytes[i]) );
}
msg = new Message();
Bundle b = new Bundle();
b.putByteArray("KEY", bytes);
msg.setData(b);
handler_2.sendMessage(msg);
} else {
Thread1 = new Thread(new Thread1(handler_2,false));
Thread1.start();
return;
}
} catch (IOException e) {
e.printStackTrace();
}
}
Looper.loop();
}
}
}
NOW THE PROBLEM IS:
I am receiving correctly my data (package of 13 bytes each) from Raspberry Pi, indeed:
Log.d("Data received", "valuewifi " + (0xFF & bytes[i]) );
prints correctly my values. Then I create the message to be sent to the handler in MainActivity. the Bundle contains (I have verified) the same values of the input stream received, but the message printed in the Handler of the MainActivity:
Log.d("Data received", "value " + (0xFF & bytes[i]) );
substitutes the first byte value of each message (I am trying to get 2 package each communications with the RPi) with 66 that actually is the ASCII code of "B" that I sent to start the data sending from Raspberry Pi.
PLEASE DO YOU HAVE ANY IDEA ON WHY THIS IS HAPPENING?
Many thanks for your help in advance!:)
Well, I have found that in Thread2 if I put
public byte[] bytes = new byte[13];
inside the run{..} before
in.readFully(bytes);
The exchange of message happens perfectly. Otherwise I only get in MainActivity the last package of byte received from the server.
Any suggestion on why does it happen?
Thanks!

How to pass data from one activity to another activity in Android

Im a newbie to android. i want to create an application that sends the user1 location to the user2 using ServerSocket.
public class ToMain extends Activity {
TextView info, infoip, msg;
String message ="";
ServerSocket serverSocket;
String s="",t="";
public Double b,c;
public int i;
private class SocketServerThread extends Thread {
static final int SocketServerPORT = 8080;
int count = 0;
#Override
public void run() {
Socket socket = null;
DataInputStream dataInputStream = null;
DataOutputStream dataOutputStream = null;
try {
serverSocket = new ServerSocket(SocketServerPORT);
ToMain.this.runOnUiThread(new Runnable() {
#Override
public void run() {
info.setText("I'm waiting here: "
+ serverSocket.getLocalPort());
}
});
while (true) {
socket = serverSocket.accept();
dataInputStream = new DataInputStream(
socket.getInputStream());
dataOutputStream = new DataOutputStream(
socket.getOutputStream());
String messageFromClient = "";
//If no message sent from client, this code will block the program
messageFromClient = dataInputStream.readUTF();
I Split the Latitude and Longitude this way in the Server side
for(int j=0;j<i;j++){
if(messageFromClient.charAt(j)!='+' && bool==false){
s=s+messageFromClient.charAt(j);
}
else{
bool=true;
}
if(bool){
t=t+messageFromClient.charAt(j);
}
}
I Store in these two Variable
b = Double.parseDouble(s);
c = Double.parseDouble(t);
ToMain.this.runOnUiThread(new Runnable() {
#Override
public void run() {
}
});
String msgReply = "Location Sent!" + count;
dataOutputStream.writeUTF(msgReply);
i want to send those variable from here to the main activity which contain the map
// startActivity(intent);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
final String errMsg = e.toString();
ToMain.this.runOnUiThread(new Runnable() {
#Override
public void run() {
}
});
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (dataInputStream != null) {
try {
dataInputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (dataOutputStream != null) {
try {
dataOutputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
How do i pass a and b to the main activity.
Pass data through intents.
Intent data = new Intent(this,SecondActivity.class);
data.putExtra("keyA",a);
data.putExtra("keyB",b);
startActivity(data);
In second activity in onCreate()
Intent intent = getIntent();
Double a = intent.getDoubleExtra("keyA",0);
Double b = intent.getDoubleExtra("keyB",0);
Use Intent to pass data from one activity to another activity
Intent intent = new Intent(this,SecondActivity.class);
intent .putExtra("key1",value);
intent .putExtra("key2",value);
startActivity(intent );
In second activity in onCreate()
Intent intent = getIntent();
Double a = intent.getDoubleExtra("key1",0); // Notice 0 is the default value here
Double b = intent.getDoubleExtra("key2",0);
To pass data from one Activity to another, you can use Extras in Intent.
Intent intent = new Intent("ACTIVITY_INTENT");
intent.putExtra("selection", position);
startActivity(intent);
You can send Binary, Text and multiple pieces as listed here,
http://developer.android.com/training/sharing/send.html
To receive the data in the next activity, in the oncreate method of the activity,
extras = getIntent().getExtras();
int value = extras.getInt("selection");
In case if you want to persist the data, the simplest way to achieve this would be saving it in Shared Preferences.
Developer link has good information on how to implement this - http://developer.android.com/training/basics/data-storage/shared-preferences.html
To write the data,
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt(getString(R.string.saved_high_score), newHighScore);
editor.commit();
To read the data,
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
int defaultValue = getResources().getInteger(R.string.saved_high_score_default);
long highScore = sharedPref.getInt(getString(R.string.saved_high_score), defaultValue);
all the best
In Android user interface is displayed through an activity. Activity is used to represent the data to user and allows user interaction. In an android application, we can have multiple activities and that can interact with each other. During activity interaction we might required to pass data from one activity to other.
Now, to pass data from one activity to other in android, you need to do the following :
You can send data from one actvity to another with an Intent.
An intent contains the action and optionally additional data. The data can be passed to other activity using intent putExtra() method. Data is passed as extras and are key/value pairs. The key is always a String. As value you can use the primitive data types int, float, chars, etc. We can also pass Parceable and Serializable objects from one activity to other.
Intent intent = new Intent(context, YourActivityClass.class);
intent.putExtra(KEY, <your value here>);
startActivity(intent);

one receive method getting null data

In my code, I am starting timerTask when broadcast message received.
Here I displayed code of two classes.
1. broadcast receiver.
2. XML parsing.
my Question is when I call timerTask, at scheduled time Timer call & I get all data into xml class.Like "mServiceList" .But When I want to use this array every time it is getting null.
I am not sure where I am doing wrong.
If any body have idea, then its great.
public class MyWidgetIntentReceiver extends BroadcastReceiver {
public static int clickCount = 0;
private String msg[] = null;
private ParsingXML myXMLHandler;
private ArrayList<Stream> mServiceList = new ArrayList<Stream>();
private UrlTimerTask mUrlTimerTask = null;
private Timer mTimer = null;
private String rssFeed = "https;??.....";
#Override
public void onReceive(Context context, Intent intent) {
mUrlTimerTask = new UrlTimerTask();
mTimer = new Timer();
mTimer.scheduleAtFixedRate(mUrlTimerTask, 0, 120000); // (60*2*1000)
if (intent.getAction().equals(WidgetUtils.WIDGET_UPDATE_ACTION1)) {
Toast.makeText(context, "NEXT!!", Toast.LENGTH_SHORT).show();
updatePreviousWidgetListener(context);
}
}
private void updatePreviousWidgetListener(Context context) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
// updating view
remoteViews.setTextViewText(R.id.title, getNextTitle(context));
remoteViews.setTextViewText(R.id.desc, getDesc(context));
// re-registering for click listener
remoteViews.setOnClickPendingIntent(R.id.sync_button,
MyWidgetProvider.buildButtonPendingIntent(context));
// re-registering for click listener
remoteViews.setOnClickPendingIntent(R.id.next,
MyWidgetProvider.buildNextButtonPendingIntent(context));
MyWidgetProvider.pushWidgetUpdate(context.getApplicationContext(),
remoteViews);
}
private String getDesc(Context context) {
// some static jokes from xml
msg = context.getResources().getStringArray(R.array.news_headlines);
if (clickCount >= msg.length) {
clickCount = 0;
}
return msg[clickCount];
}
private String getNextTitle(Context context) {
if (mServiceList != null && mServiceList.size() > 0) {
return mServiceList.get(clickCount).getTitle().toString();
} else {
mStreamList = myXMLHandler.getItemsList();
Toast.makeText(context, "no data found", Toast.LENGTH_SHORT).show();
return "no data";
}
}
private class UrlTimerTask extends TimerTask {
#Override
public void run() {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
myXMLHandler = new ParsingXML();
xr.setContentHandler(myXMLHandler);
URL _url = new URL(rssFeed);
xr.parse(new InputSource(_url.openStream()));
mServiceList = myXMLHandler.getItemsList();
if (!mServiceList.isEmpty()) {
for (int i = 0; i < mServiceList.size(); i++) {
Log.d(TAG, mServiceList.get(i).getTitle());
}
}
} catch (ParserConfigurationException pce) {
Log.e("SAX XML", "sax parse error", pce);
} catch (SAXException se) {
Log.e("SAX XML", "sax error", se);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Still you have any query regarding to understand my question pls tell me I will try my best to understand my query. because I want answer.
Short Note : I want to use parsing data into broadcast receiver class.
Thanks,
I couldn't understand, in your BroadcastReceiver's onReceive(Context context, Intent intent) , you called updatePreviousWidgetListener(context); this method. But rest of your code shows no call to this method.
If I am not wrong, you have called wrong method in onReceive(Context context, Intent intent). When does updatePreviousWidgetListener(context); get called?
Correct me if I am wrong.

Android Activity does not receive messages from IntentService using BroadcastReceiver

I am trying to develop an android app to measure QoS of networks. The app sends UDP packets to a UDP server running on my system. Since this is a long running process, I have implemented the UDP connection in a class which extends IntentService.The reason behind using IntentService is that I need to pass some parameters to the Service. I have a BroadcastReceiver in my activity which listens for messages from the IntentService and prints it. My problem is that although the IntentService is running smoothly, but the activity is not receiving the messages from it. I am new to android development, so please excuse my lack of understanding and any guidance/suggestions will be deeply appreciated. I am posting some parts of my code below. The Logcat does not show any errors.
I have seen intent.setAction() method being used in some examples, but I am not very clear about how to use it in my case.
The BroadcastReceiver (defined within my Activity class)
public class UdpResponseReceiver extends BroadcastReceiver {
public static final String ACTION_RESP = "com.example.udpmessageclient.intent.action.MESSAGE_PROCESSED";
#Override
public void onReceive(Context context, Intent intent) {
System.out.println(UdpService.PARAM_OUT_MSG);
}
I have registered the receiver:
IntentFilter filter = new IntentFilter(UdpResponseReceiver.ACTION_RESP);
filter.addCategory(Intent.CATEGORY_DEFAULT);
receiver = new UdpResponseReceiver();
registerReceiver(receiver, filter);
IntentService class:
public class UdpService extends IntentService {
//..variable declarations
public UdpService() {
// TODO Auto-generated constructor stub
super("UdpService");
}
#Override
protected void onHandleIntent(Intent intent) {
// TODO Auto-generated method stub
host = intent.getStringExtra("host");
port = intent.getIntExtra("port", 4000);
pType= intent.getIntExtra("pType", 0);
delay = intent.getIntExtra("delay", 0);
msg= intent.getStringExtra("msg");
broadcastIntent = new Intent();
broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
broadcastIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
try {
addr = InetAddress.getByName(host);
// addr=InetAddress.getLocalHost();
socket = new DatagramSocket();
// socket.connect(addr,port);
System.out.println("\nSocket Connected");
} catch (Exception e) {
System.out.println("\nConnection failed");
return;
}
send=true;
switch (pType) {
case 0:
while (send) {
sendPacket(msg);
}
case 1:
while (send) {
try {
Thread.currentThread().sleep(delay);
} catch (Exception e) {
}
sendPacket(msg);
}
case 2:
while (send) {
int u = want(30);
String data1 = "";
while ((u--) > 0)
data1 = data1 + msg;
sendPacket(data1);
}
case 3:
while (send) {
int u = want(30);
System.out.println(u);
String data1 = "";
while ((u--) > 0)
data1 = data1 + msg;
System.out.println("data length :" + data1.length());
try {
Thread.currentThread().sleep(delay);
} catch (Exception e) {
}
sendPacket(data1);
}
}
}
public void onDestroy(){
super.onDestroy();
send=false;
socket.close();
socket=null;
}
void sendPacket(String text) {
try {
System.out.println("\nClient:: Sending packet: " + " to " + addr
+ port);
byte[] data = text.getBytes();
spacket = new DatagramPacket(data, data.length, addr, port);
socket.send(spacket);
String resultTxt="Sent Packet at:"+DateFormat.format("MM/dd/yy h:mmaa", System.currentTimeMillis());
// this is where I am trying to send message back to the activity
broadcastIntent.putExtra(PARAM_OUT_MSG, resultTxt);
sendBroadcast(broadcastIntent);
} catch (Exception e) {
System.out.println("Error:" + e.getMessage());
e.printStackTrace();
return;
}
}
}
logcat error messages when the service is stopped:
01-14 15:53:41.446: W/System.err(1176): java.lang.NullPointerException
01-14 15:53:41.456: W/System.err(1176): at com.example.udpmessageclient.UdpService.sendPacket(UdpService.java:123)
01-14 15:53:41.466: W/System.err(1176): at com.example.udpmessageclient.UdpService.onHandleIntent(UdpService.java:74)
01-14 15:53:41.466: W/System.err(1176): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
01-14 15:53:41.466: W/System.err(1176): at android.os.Handler.dispatchMessage(Handler.java:99)
01-14 15:53:41.466: W/System.err(1176): at android.os.Looper.loop(Looper.java:137)
01-14 15:53:41.476: W/System.err(1176): at android.os.HandlerThread.run(HandlerThread.java:60)
Change the code of UdpService as ...
broadcastIntent = new Intent(UdpResponseReceiver.ACTION_RESP); // You forgot to add your custom intent filter
broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
//broadcastIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); // I don't think you really need it. So you can remove this flag.
UPDATE
public static final String ACTION_RESP = "com.example.udpmessageclient.intent.action.MESSAGE_PROCESSED";
private final BroadcastReceiver UdpResponseReceiver = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
//TODO handle results
}
};
And register it as
registerReceiver(UdpResponseReceiver, new IntentFilter(ACTION_RESP))

Categories

Resources