PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Receiving a implicit intent in android
Receiving a implicit intent in android
Débuté par Cemerin, 27 oct. 2017 10:40 - 3 réponses
Posté le 27 octobre 2017 - 10:40
Hi
I am trying to receive data over an implicit intent in android.
I figured out where you can modify the android manifest to register an intent filter (https://doc.pcsoft.fr/en-US/?9000109#NOTE_CONFIG),
but I can't get the data because it is send to the main activity and god knows where that is.

The code in android studio would look something like this:
import android.app.Activity;  
import android.content.Intent; 

public class MainActivity extends Activity {      // <- Where is my main activity?
   
   ...
   
   // We need to handle any incoming intents, so let override the onNewIntent method  
   @Override  
   public void onNewIntent(Intent i) {      // <- Where can I override this?
      handleDecodeData(i);  
   }
   
   // This method is responsible for getting the data from the intent  
   // formatting it and adding it to the end of the edit box  
   private void handleDecodeData(Intent i) {
      ...
   }
}


One solution would be to make an external .aar in android studio, but that would split the code and make it clunky.
A different approach would be to define a second activity, but for that I would need to define a java class and I didn't figure out how to do that in Windev.

It seems like an essential functionality, maybe I’m missing something?
Any help would be appreciated.
Posté le 30 octobre 2017 - 12:12
Hi Cemerin,

I haven't tried, but in general, this kind of code goes in a global
procedure in JAVA and is called from anywhere in the program (in your
case I guess from the project init code)

As your windev mobile project is ultimately translated in Java, there is
a good chance that all standard elements are present and accounter for,
and therefore that this method would work.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 10/27/2017 à 2:40 AM, Cemerin a écrit :
Hi
I am trying to receive data over an implicit intent in android.
I figured out where you can modify the android manifest to register an
intent filter (https://doc.pcsoft.fr/en-US/?9000109#NOTE_CONFIG),
but I can't get the data because it is send to the main activity and god
knows where that is.

The code in android studio would look something like this:
import android.app.Activity; import android.content.Intent;
public class MainActivity extends Activity {      // <- Where is my main
activity?
  ...
  // We need to handle any incoming intents, so let override the
onNewIntent method   @Override   public void onNewIntent(Intent i)
{      // <- Where can I override this?
     handleDecodeData(i);   }
  // This method is responsible for getting the data from the intent
// formatting it and adding it to the end of the edit box   private void
handleDecodeData(Intent i) {
     ...
  }
}


One solution would be to make an external .aar in android studio, but
that would split the code and make it clunky.
A different approach would be to define a second activity, but for that
I would need to define a java class and I didn't figure out how to do
that in Windev.

It seems like an essential functionality, maybe I’m missing something?
Any help would be appreciated.
Posté le 01 novembre 2017 - 09:50
Thank you for your response!
Unfortunately it doesn't seem to be that simple,
since each set of procedure seems to make a separate class in the generated .java files.
Also the window class extends WDFenetre instead of Activity.

I guess I will try the external library approach, spent enough time searching for now.
BTW, does the DevTeam have a suggestion box? Implicit / explicit intents would make a nice language feature.
Posté le 02 novembre 2017 - 16:19
Hi again,

searching for now.
BTW, does the DevTeam have a suggestion box? Implicit / explicit intents
would make a nice language feature.


Yes they do. It's in the editor itself, in the help menu, if I recall
correctly. It's called something like 'contact free technical support'.

In the tool, there is a choice between bug report and wish list.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com