Recent

Author Topic: jBroadcastReceiver  (Read 3030 times)

schumi

  • New Member
  • *
  • Posts: 45
jBroadcastReceiver
« on: April 08, 2024, 10:37:22 pm »
Hi,
I need to replicate this java code for broadcast receiver

Code: Java  [Select][+][-]
  1.  
  2.                 filter = new IntentFilter();
  3.                 filter.addAction(ACTION_BROADCAST_RECEIVER);
  4.                 filter.addCategory(CATEGORY_BROADCAST_RECEIVER);
  5.                 registerReceiver(receiver, filter);
  6.  

I try to modify jBroadcastReceiver.java but don't work (I don't know java)
Code: Java  [Select][+][-]
  1. public void RegisterIntentActionFilter(String _intentAction, String _intentCategory) {
  2.            //intentFilter.addDataScheme("http");                      
  3.            //intentFilter.addDataScheme("ftp");
  4.            //intentFilter.addAction(BluetoothDevice.ACTION_FOUND);       
  5.            filter = new IntentFilter();
  6.            filter.addAction(_intentAction);
  7.            if (_intentCategory != null) {
  8.                         filter.addCategory(_intentCategory);
  9.        }
  10.                
  11.            controls.activity.registerReceiver(this, filter);
  12.            //Log.i("receiver","Register ....");
  13.    }
  14.  

schumi

  • New Member
  • *
  • Posts: 45
Re: jBroadcastReceiver
« Reply #1 on: April 12, 2024, 10:15:59 am »
Hi,
I have find solutions

add to broadcastreceiver.pas
Code: Pascal  [Select][+][-]
  1. procedure RegisterIntentActionFilter(_intentActionFilter: string; _intentCategory: string); overload;

add to jBroadcastReceiver.java
Code: Pascal  [Select][+][-]
  1. private IntentFilter filter = null;
  2.  
  3. public void RegisterIntentActionFilter(String _intentAction, String _intentCategory) {
  4.            filter = new IntentFilter(_intentAction);
  5.            filter.addCategory(_intentCategory);
  6.        
  7.                
  8.            controls.activity.registerReceiver(this, filter);
  9.            //Log.i("receiver","Register ....");
  10.    }
  11.  
  12.  

Guser979

  • Jr. Member
  • **
  • Posts: 64
Re: jBroadcastReceiver
« Reply #2 on: April 12, 2024, 11:25:06 am »
Congratulations. You said you don't know Java. But LAWM ends up making us know a little after so much research.

I think that despite the time we spent on this and all the work to test each change, it is worth keeping LAMW alive.

schumi

  • New Member
  • *
  • Posts: 45
Re: jBroadcastReceiver
« Reply #3 on: April 12, 2024, 06:42:28 pm »
thanks to copy and paste ;)

Guser979

  • Jr. Member
  • **
  • Posts: 64
Re: jBroadcastReceiver
« Reply #4 on: April 12, 2024, 10:03:34 pm »
thanks to copy and paste ;)

Copying and pasting is laborious too. That's part of the job. haha ha  :P

 

TinyPortal © 2005-2018