I am trying to build a dictionary app in Flutter (mostly irrelevant since this would probably have to be implemented separately for android and iOS). The app should display translations when the user selects a word, or when the user clicks one of the menu items that pop up on selection. I've been trying to research this for a while but I just can't figure it out.

I am basically trying to replicate this app:

Popup Japanese Dictionary

App: https://play.google.com/store/apps/details?id=com.niftygnomes.popupjapanesedictionary&hl=en

I know I can use ACTION_PROCESS_TEXT on android to add a menu to the menu that pops up on selection. Clicking it opens my app, which I don't want. I want it to show a popup instead. So far, I have this:

<activity
  android:name=".ProcessTextActivity"
  android:label="Translate">
  <intent-filter>
    <action android:name="android.intent.action.PROCESS_TEXT" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
  </intent-filter>
</activity>
public class ProcessTextActivity extends FlutterActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        CharSequence text = getIntent().getCharSequenceExtra(Intent.PROCESS_TEXT);
    }
}

On iOS, I don't even know where to start. I can't find any API that would help me achieve this.

Any help that points me in the right direction would be appreciated. Thanks!

0 Answers