PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV Mobile 2024 → [WM23] Share Menu Android
[WM23] Share Menu Android
Iniciado por ARV, 06,feb. 2019 20:17 - 9 respuestas
Miembro registrado
503 mensajes
Publicado el 06,febrero 2019 - 20:17
Hi

I want to put the app I develop on the shared menu of android
is it possible?.

What I mean it's

Open Galery App of android
Select an image and select the option share
on the menu the app (windev that I develop) appear
select the app
process the image or the file send it.


--
Best Regards
ARV
Miembro registrado
28 mensajes
Publicado el 07,febrero 2019 - 13:45
Hi,

So far as I can see you need to use the java functions in Windev Mobile to accomplish this:

See Android documentation:
https://developer.android.com/training/sharing/receive

The manifest can be edited in the compile (deploy) wizard.

Regards,
Joey
Miembro registrado
503 mensajes
Publicado el 07,febrero 2019 - 14:39
Hi Joey Dieleman

Thanks for your reply

Yes I end up with the manifest.xml on the compile section, just in the final process on the advance settings
I manage to create the code for my manifest but if I change it, it will dissapear my icon of my app for some reason.
I'm really new about this manifest on Windev.
With the link you give me I only copy and paste the code of the manifest on the section of <application> of the list manifest from windev mobile 23
and with that my icon doesn't disapear (I was naive about where to put the code I need) / (on other web sites I found the same code but the one you give me add some other things that make me clear every question I have and put the code on the exact spot)

Now I need to process the text, image or things other apps gives me.
Yes I know that I need to put some java code, the thing it's where I call it on windev process?
on the start of the app? on background?
I still don't know, or only with put it on a global procedure with java code on windev it will launch alone.

They said to put it on onCreate method and so on. Windev can't create such method or even class they need only one method per Java global procedure, maybe I could create .jar or something but I'm not sure

I hope my new question can be clear.

--
Best Regards
ARV
Miembro registrado
28 mensajes
Publicado el 07,febrero 2019 - 16:42
Well I didn't do this in an app before, but done a lot with java in Windev (also done some work on broadcasts to receive network changes etc).
A approach what works for me is to create one 'main' java procedure (a global procedure) and call this from the initialisation code of the project ('initializing the project').

Then the java procedures you program in this function will be from the main thread, and always active in your app. I guess this is the approach you need.

Hope this helps you.

Regards,
Joey
Miembro registrado
503 mensajes
Publicado el 07,febrero 2019 - 18:55
Hi Joey Dieleman

Thanks for you reply
I see I will testing that but for now I have some java compile errors at the moment.

I import everything I think was necesary for get to working but there's one function that doesn't let me compile.
Hope you can give me an idea or something, I search for this but I couldn't kill this error.

The code it's the exact same as the link you provide me, but in this part:
//ALSO! the Bundle savedInstanceState, I can't put it on my java Code Global Procedure it's not 
//String,int or boolean so I don't know what to do
//it's seems to be very important but I decided to erase it but well can't compile for the error
//I really mention at the moment.

void onCreate (Bundle savedInstanceState) {

    Intent intent = getIntent(); //HERE! it's the error.


what Java said it's this:

Failure creating the Android application named <C:\My Mobile Projects\FileProject\Exe\Project.apk>.


Command Line: "C:\Program Files\Java\jdk1.8.0_172\bin\java.exe" "-Dorg.gradle.appname=C:\My Mobile Projects\FileProject\Android\Gen" ->classpath "C:\WINDEV Mobile 23\Personal\Android\Gradle\lib\gradle-launcher-2.14.1.jar" org.gradle.launcher.GradleMain assembleRelease -b >"C:\My Mobile Projects\FileProject\Android\Gen\build.gradle"


Error returned:

:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\My Mobile Projects\FileProject\Android\Gen\src\com\mycompany\FileProject\wdgen\GWDCPCOL_Java.java:37: error: cannot find symbol
Intent intent = getIntent();
---------------------^
symbol: method getIntent()
location: class GWDCPCOL_Java
Note: C:\My Mobile Projects\FileProject\Android\Gen\src\com\mycompany\FileProject\wdgen\GWDCPCOL_Extencion.java uses unchecked or >unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:compileReleaseJavaWithJavac FAILED


I search about the getIntent(); function it looks like the class where are the method that use it needs to be extended with some other class, now this class I don't remember how it's called at the moment.

Do you know something about this? for get this to work, also about the parameter called Bundle SavedInstanceState

Thanks for all your help and replys by the way.

--
Best Regards
ARV
Mensaje modificado, 07,febrero 2019 - 18:59
Miembro registrado
28 mensajes
Publicado el 08,febrero 2019 - 08:40
Indeed the compiler hangs with getIntent, If you look for Intent you need to import this:
https://developer.android.com/reference/android/content/Intent

So at the top of your code (doesn't need to be on the top it can also be imported just before you code) you enter the following:
import android.content.Intent;

So the trick is if you get compile errors with symbol: method xxxxx(), search in google for "Android xxxx" then you see the class you need to import.

Example:

java.lang.Object
↳ android.content.Intent

... means "import android.content.Intent;"


I hope this helps you.

Regards,
Joey
Miembro registrado
503 mensajes
Publicado el 08,febrero 2019 - 14:21
Hi Joey Dieleman

I import everything I think it's necessary and still get the same error here's all the code:

import android.content.Intent;
import android.app.Activity;
import android.content.Context;

import android.app.Fragment;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

PUBLIC static void Test() //ALSO! I can't put Bundle savedInstanceState on the parameter of my global JAVA Procedure because of the type.
{
// Get intent, action and MIME type
Intent intent = getIntent(); //HERE it's the error Windev (Java) the error it's: "Cannot find symbol"
string action = intent.getAction();
string type = intent.getType();

IF (Intent.ACTION_SEND.equals(action) && type != Null) {
IF ("text/plain".equals(type)) {
//handleSendText(intent); // Handle text being sent
} ELSE IF (type.startsWith("image/")) {
//handleSendImage(intent); // Handle single image being sent
}
} ELSE IF (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != Null) {
IF (type.startsWith("image/")) {
//handleSendMultipleImages(intent); // Handle multiple images being sent
}
} ELSE {
// Handle other intents, such as being started from the home screen
}
}


Thanks for your reply and ideas I really appreciate it.

--
Best Regards
ARV
Miembro registrado
28 mensajes
Publicado el 11,febrero 2019 - 11:47
Hi,

Well I should try it myself before I can answer this, do you really get the SAME error?

Regards,
Joey
Miembro registrado
503 mensajes
Publicado el 12,febrero 2019 - 14:06
Hi Joey Dieleman

Yes it gives me the same error that "Cannot find symbol" even if I import the intent

Thanks for your reply.

--
Best Regards
ARV
Publicado el 10,julio 2023 - 13:19
Ca aidera surement des gens de passage, il faut utiliser : Intent intent = getActiviteEnCours().getIntent();
"getActiviteEnCours()" étant une fonction PCSoft pour récupérer le context.