unable to write data in SDcard (lollipop) without user interaction android - android-sdcard

I am working on Sdcard Dignostics functionality.I need to perform sdcard read and write functionality in kitkat and lollipop device.There is no direct way to perform
read and write in kitkat and lollipop.
But i am able to do this in kitkat following way:
-->Adb shell mkdir stoare/extSdCard/Android/data/com.sample.demo(your package name)
Then we can perfrom read write operations in com.sample.demo folder.
For lollipop using DocumentFile class we can perfrom read and operations for this we need user interaction.
Now my problem is with out user interaction we need to perform read and write,can you please infrom any alternate way like above kitkat procedure.
Thanks in advance

That is the design of Lollipop. There is no way to workaround that.
The user interaction for giving permission through SAF is anyway needed only once.
More info : How to use the new SD card access API presented for Android 5.0 (Lollipop)?

Related

Can I write to a text file from a button in xPages?

I have an xPages application that needs to write a text file to a folder on my network. I'm not sure if it's even possible from an xPages application?
If it is, can someone give me an idea how to go about this?
POI4XPages can write views etc to CSV files https://poi4xpages.openntf.org/. I've previously used OpenCSV, and Apache-licensed Java library to import from a CSV file, but it also allows exporting. I use it regularly to preload data for session databases like for my session at Connect 2016. CommonsCSV has subsequently been released, which would replace OpenCSV.
Yes you can. The easiest way is to create a Java class that does what you need (and test it from the command line). In a button, which is server side JavaScript, you can instantiate that class and write out.
You might need to handle security setting (e.g. deploying your class in a jar file into [DominoAppDir]/jvm/lib/ext) to be allowed to have network access. If you rather keep the class in the nsf, you might need harder measures.
Let us know how it goes
I just created a simple class that created the file and wrote to it. Worked like a champ
Thanks all!

play a dynamic sound file in asterisk musiconhold

I have used asterisk MusicOnHold with that I have to point a particlar folder in musiconhold.conf and during the execution all the tone inside that folder are played for all the users.
But now I have to play a specific sound file for each user uploaded by them.My problem is that how can I play this file for user.Because if he uploads a sound file then I have to manually create a class in musiconhold.conf pointing to that folder the do moh reload.
I just want to automate the things to the user just uploads the sound file and during the call of that user in extensions.conf I can point to that sound file and it will be played without reload or adding context in musiconhold.conf everytime.
For ex. the way Playback(pathToSoundfil) works which takes tone path directly is there any function like in musiconhold for directly passing the sound file?
Thanks
You can do as many section in your musiconhold file as you want.
After that you can use thoose class
No, you can't change classes without reload res_musiconhold
However you can use asterisk realtime architecture and put whole config into mysql. Still need do script which will do reload.
If you want 100% realtime solution, you can use conference and play into same conference any file. Just create enother call to conference which play file. This variant require expert level in asterisk.

How to add User Specific information in Exe File

I have a code on the server-side(application) that links with the client-side(application).
The user signs-up to download the exe(client-side application).
There must be a unique way to identify the user(client app exe) with the info got from sign-up.
So, one of the information must be attached to exe file during the download.
One of the ways I found is using "Portable Executable".
Is it possible to add string data to exe and later retrieve it?
Is there any other possible way to make the exe user-specific? Or is it possible to add the user information along with the downloaded exe?
Yes, it is potentially possible to modify the exe at runtime to put your own stream. You might put the User Specific information in an existing Resource prepared for this "update". This would be the easiest way to avoid to take care about changing other parameter like size, etc.. Another option would be to put the User Specific information in the overlay of the Exe.

How we can write in a file through a j2me code?

How we can write in a file through a j2me code ?
Does your J2ME support JSR-75? If so, see here
http://developers.sun.com/mobility/apis/articles/fileconnection/
this is he JSR75 spec, basically it just means to create a connector (FileConnectoion) and open a stream, once you hve it you can do various operation with hte file like chance to hidden, delete, create open etc..
If JSR-75 does not exists on the device (rare these days) your ownly options for storage is RMS, and if you want just to read files you have in your application you can use class.OpenResourceasStream(resname);

Changing vista file permissions programmatically

I want to add some files to C:\windows\XXX (windows protected folder, in Vista), under the "TrustedInstaller" for my application. I do not want to replace any file so no issues on Windows Resource(formerly file) protection.
I have the code to change "ownership" to the current logged in admin, however, I'm don't have any clue how to set its file permissions programmatically. I'm using VC++/MFC for development.
Thanks
I not 100% sure what you actually want (as do you want it to look like TrustedInstaller installed the files?) but look at this example of using SetNamedSecurityInfo. You generally need to constuct a Discretionary Access Control List (DACL) for your file, however you can "borrow" one off another file with the permissions you want to clone using GetNamedSecurityInfo as building a DACL from scratch is considerably more annoying.
An easy way to do it is to just use the system function to run icacls with whichever parameters you need. Note that it's found in cstdlib (#include <cstdlib>)
system("icacls <params>");

Resources