Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple file when app working on background not get catch #73

Open
tarangshah19 opened this issue Mar 9, 2023 · 4 comments
Open

multiple file when app working on background not get catch #73

tarangshah19 opened this issue Mar 9, 2023 · 4 comments

Comments

@tarangshah19
Copy link

tarangshah19 commented Mar 9, 2023

i am using vue js in app.vue i have following code

async checkIntent() {
   console.log("Checking Intent")
   try {
     let result = await SendIntent.checkSendIntentReceived();
     
     if (result) {
       //console.log("SendIntent found", JSON.stringify(result));
     }

     if (result && result.url) {
       let resultUrl = decodeURIComponent(result.url);
       //console.log("resultUrl:", resultUrl);
       await this.$store.dispatch("sendIntent/getIntent", result);
       this.$router.push("/create-post");
        
       // this.intentData.value = {
       //   url: resultUrl
       // }
       // Filesystem.getUri({path: resultUrl})
       // .then((content) => {
       //     console.log('hi this is test',content);
       // })
       // .catch((err) => console.error(err));
     }
   } catch (error) {
     console.log("Error handing sendIntent:", error);
   }
 },

for single image its working fin but more then 1 its not working not get catch files can you tell me how to to solved this issue

in mainActivity.java

public class MainActivity extends BridgeActivity {
    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        String action = intent.getAction();
        String type = intent.getType();
        if (Intent.ACTION_SEND.equals(action) && type != null) {
            bridge.getActivity().setIntent(intent);
            bridge.eval("window.dispatchEvent(new Event('sendIntentReceived'))", new ValueCallback<String>() {
                @Override
                public void onReceiveValue(String s) {
                }
            });
        }
    }

have this code also

@carsten-klaffke
Copy link
Owner

Hey tarangshah19, is this still an issue? I saw you got help in another thread (#75) already?!

@tarangshah19
Copy link
Author

yes still not able to do can you please help me

@carsten-klaffke
Copy link
Owner

carsten-klaffke commented Apr 18, 2023

The way you configured your MainActivity, you will need to register a Listener in your app like that:

window.addEventListener("sendIntentReceived", () => {
   Plugins.SendIntent.checkSendIntentReceived().then((result: any) => {
        if (result) {
            // ...
        }
    });
})

However, I do recommend to configure a separate activity in AndroidManifest.xml starting the SendIntentActivity and closing it after processing the intent with "finish()". See the current Readme or #69 if you want to implement it this way!

@tarangshah19
Copy link
Author

ok i will check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants