[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[jx8Intents] Play a media file


SwikiCodeRobot @> 586

"Play a media file."
| intent context uri |
uri := Uri parse: 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg'.
context := MainActivity current.
intent := Intent action: Intent actionView.
intent data: uri.
(intent resolveActivity: context packageManager) isNil ifTrue: [
	self error: 'Intent canīt be resolved'
].
context startActivity: intent.
^#Ok