I need to implement a service that records the name of a text file that can be opened by any program.

It seems to me that I need to use

Intent.ACTION_VIEW Intent.ACTION_GET_CONTENT 

Already tried to connect the action to the receiver.

 <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.ACTION_OPEN_DOCUMENT" /> 

But an excerpt from my service:

 File aFile = new File(filePath); FileWriter fOut = new FileWriter(aFile, true); if(Intent.ACTION_VIEW.contains(".txt")) fOut.append("DOC " + time1 + " " + date1 + "\n"); 

The service should respond to ACTION_OPEN_DOCUMENT . But how then to understand what exactly * .txt was open? And I even dig in that direction?)

  • > And I even dig in that direction? No, because the message Intent will be sent to only one application that will process it, and the remaining subscribers will not receive it. - Egor tepikin

0