Android Question Releasing Starting Intent - Lock?

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I finally have my program registered as the default app when a MP3 file is click but have come across another problem.

I am using a Samsung S3.

When I go into "My Files" explorer and click on a MP3 file it starts my App and my app starts playing the song.

If I then click on Home button (music keeps playing as it should) and then click on the "My Files" explorer Icon it jumps right to my program.

It seems that because the "My Files" explorer program started my program we are kind of linked together.

How do I break this link (without exiting my program) so that I could select another file to play or do something else with "My Files" explorer?

Even after the song is done playing I am still locked to the "My Files" explorer.

Once I exit my program I return back to the "My Files" explorer exactly where I was?

Thanks
BobVal
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
From what I can find I need to return a result intent.

But I cannot seem to return a result intent without Finishing the program.

Anyway I can return a result intent and keep the program active?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
B4X:
		Dim ResultIntent As Intent
		  
		ResultIntent.Initialize("com.BOBs.RESULT_ACTION", "")
		ResultIntent.PutExtra("Result", -1)
		
               Dim MyPhone As Phone
	   
              MyPhone.SendBroadcastIntent(ResultIntent)

Seems creating and broadcasting a intent with a result of -1 makes everyone happy.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Strike what I said above. It turns out just by have the below line in my Manifest solved the problem

SetActivityAttribute(Main, android:launchMode, "singleInstance")
 
Upvote 0
Top