PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → [WM23] Share Menu Android
[WM23] Share Menu Android
Iniciado por ARV, fev., 06 2019 8:17 PM - 9 respostas
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em fevereiro, 06 2019 - 8:17 PM
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
Membro registado
28 mensagems
Popularité : +2 (2 votes)
Publicado em fevereiro, 07 2019 - 1:45 PM
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
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em fevereiro, 07 2019 - 2:39 PM
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
Membro registado
28 mensagems
Popularité : +2 (2 votes)
Publicado em fevereiro, 07 2019 - 4:42 PM
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
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em fevereiro, 07 2019 - 6:55 PM
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
Mensagem modificada, fevereiro, 07 2019 - 6:59 PM
Membro registado
28 mensagems
Popularité : +2 (2 votes)
Publicado em fevereiro, 08 2019 - 8:40 AM
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
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em fevereiro, 08 2019 - 2:21 PM
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
Membro registado
28 mensagems
Popularité : +2 (2 votes)
Publicado em fevereiro, 11 2019 - 11:47 AM
Hi,

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

Regards,
Joey
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em fevereiro, 12 2019 - 2:06 PM
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 em julho, 10 2023 - 1:19 PM
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.