Search cards with intents

DonCachopo

举人
Hi. Is there a intent I can use from another app to perform searches of flashcards ?
I would love to use tasker with this.
Thanks
 

Shun

状元
Hi, can I ask a short follow-up question? On Android, is there a URI that opens Pleco and makes it jump to the Clipboard Reader? I have an app that copies text to the clipboard and then tries to open Pleco's Clipboard Reader, but right now it opens the Dictionary only. Thanks!
 

mikelove

皇帝
Staff member
Not through a URI, no. You can do it with a regular old text sharing action though - android.intent.action.SEND or android.intent.action.VIEW directed to PlecoDocumentReaderActivity.
 

Shun

状元
Hello Mike,

thank you for your help thus far. Allow me to paste in a question:

Not through a URI, no. You can do it with a regular old text sharing action though - android.intent.action.SEND or android.intent.action.VIEW directed to PlecoDocumentReaderActivity.

We are using Flutter, and we would like to open the Pleco app from our app and direct it to the Clipboard Reader. The following code only opens the Pleco app, but not the Clipboard Reader:

Code:
const intent = AndroidIntent(
    //action: 'android.content.Intent.ACTION_SEND',  action: 'android.content.Intent.ACTION_VIEW',
     package:'com.pleco.chinesesystem',
    componentName:"com.pleco.chinesesystem.PlecoDocumentReaderActivity",
    category:"Intent.CATEGORY_LAUNCHER",
    type:"text/plain",
    flags:<int>[Flag.FLAG_ACTIVITY_NEW_TASK,Flag.FLAG_ACTIVITY_CLEAR_TOP,Flag.FLAG_ACTIVITY_SINGLE_TOP],
    arguments: {
      "android.content.Intent.EXTRA_TEXT": "隐藏全部"   },

);

await intent.launch();

We are using the library android_intent_plus: ^3.1.1.

Do you perhaps recognize a problem right away? If you do and it's somehow related to Pleco, we'd love to hear it.

Many thanks,

Shun
 
Last edited:

mikelove

皇帝
Staff member
I think CATEGORY_LAUNCHER is the problem here - is it not working with ACTION_SEND or ACTION_VIEW?
 

Shun

状元
I thank you again for your help. In case someone finds themselves in the same situation, our main programmer has now got it working with the following code:

Code:
const intent = AndroidIntent(
  action: 'android.content.Intent.ACTION_VIEW',
  package:'com.pleco.chinesesystem',
  componentName:"com.pleco.chinesesystem.PlecoDocumentReaderActivity",
  category:"Intent.CATEGORY_LAUNCHER",
  type:"text/plain",
  flags:<int>[Flag.FLAG_ACTIVITY_NEW_TASK,Flag.FLAG_ACTIVITY_CLEAR_TOP,Flag.FLAG_ACTIVITY_SINGLE_TOP],
  arguments: {
    "android.content.Intent.EXTRA_TEXT": "test"  },

);

await intent.launch();
 
Last edited:

Shun

状元
Hello Mike,

on a Pixel 4 phone running Android 13, the above code works fine with Pleco version 3.2.88 but won't work with Pleco version 3.2.90 (it just does nothing). Can I ask you whether you are using some newer Android API with Pleco 3.2.90 that is incompatible with our current app? We will try on our side if the newest android_intent_plus Flutter package does the trick. Many thanks!

Edit: According to one of our users running Android 9, the feature broke already with version 3.2.89.

Regards,

Shun
 
Last edited:

mikelove

皇帝
Staff member
It's an Android SDK change - Android 13 is way, way stricter about who gets to launch an app when once you compile against the Android 13 SDK (and we're required to use that SDK by a certain date in order to continue being hosted on Play, so not something we can just ignore / put off). We had to rewrite pretty much all of our code for launcher shortcuts around it.

Can you try dropping the CATEGORY_LAUNCHER - a big no-no on 13, it seems - and try adding a URL with "plecoopenreaderactivity:" as the scheme? You could also put the text itself somewhere accessible with a URL and just open PlecoDocumentReaderActivity sharing that URL.
 

Shun

状元
Thank you so much! Then if all else fails, we'll write the text destined for Pleco (about 5KB or so) out to a local file in a place accessible by Pleco and send Pleco a URL pointing to it. I'd love to report back how we fared.
 
Top