rust-mobile/android-activity

How to read&write Clipboard, share&receive links, tell android that app is a browser/home ?

m-hugo opened this issue · 1 comments

can i get a rust example (I don't care about the specific dependencies) that can:

  • tell android it's a web browser
  • receive the link opened from the calling app as a String/&str
  • write "hello rust" to the clipboard
  • assert the clipboard's text is "hello rust"
  • open https://www.reddit.com/r/rust/ in the reddit app (just like any web browser)
rib commented

Sorry, I think this request is asking quite a lot and isn't really describing an issue with the android-activity create.

It seems like a general question about Android development.

From what you want to do it looks like you need to investigate how to create an Intent filter on Android, something like: https://developer.android.com/training/basics/intents/filters.

You may need to use the jni crate currently to be able to call Activity getIntent() while there's currently no ndk bindings for this API.
See: https://developer.android.com/reference/android/app/Activity#getIntent()
and see: https://stackoverflow.com/questions/12841240/android-pass-parameter-to-native-activity

For the clipboard you would need to get the ClipboardManager which can be queried via a Context (including an Activity) using getSystemService

See: https://developer.android.com/reference/android/content/ClipboardManager

I'm going to close this issue, since this isn't really the best place to get general Android development support.

Best of luck.