I am using libimobiledevice to write a program named iRingtone. Hoping to set ringtones without iTunes.
Steps:
uploading .m4r to /iTunes_Control/Ringtones/
update plist file /iTunes_Control/iTunes/Ringtones.plist
The ringtone can be preview under Settings->Sounds->Ringtone, but it CAN NOT be set as the ringtone. *The system force it fallback to the default ringtone -- Opening(Default).*
Every time when i use iTools to set the ringtones, i can find that the size of MediaLibrary.sqlitedb-wal and iTunesCDB under /iTunes_Control/iTunes/ changed. But they are binaries.
So, does any one know the correct format of these two files.
Or, These two files have nothing to do with ringtones, then how to correctly set the ringtones?
Thanks a lot.
Related
I've used AudioKit.inputDevice, Audiotkit.outputDevice, and friends to get get all input and output devices on my Mac, and to get/set default input and output device.
I wish to read the current volume of these devices, and to be able to set it myself, but I can't find the correct AudioKit API for doing so.
Does anyone know how to do this?
You will want to use a library similar to https://github.com/InerziaSoft/ISSoundAdditions
Changing sound volume becomes as simple as:
[NSSound setSystemVolume:0.5]
--
Duplicate of: Change Volume on Mac programmatically
I found that a variable created in SpringBoard can not be accessed by other regular applications. But now I want to make a flag variable that can share status in the global environment efficiently.
I thought a file created at some path could do that, but that may be not fast enough.
Does any body know how to do this?
You can try combination of a file with notifications of changes in this file. Notifications between processes can be sent in two ways:
Darwin notification center CFNotificationCenterGetDarwinNotifyCenter
Distributed notification center CFNotificationCenterGetDistributedCenter - private API
Distributed notification center is better because you can send notification with some data attached to it. Darwin notification center ignores all user info passed to it. So when you changed some flag and saved it in a file you can send notification with this flag's new value. You don't even need to open file and get flag's value yourself. All other apps just need to listen for this notification.
Here is CFNotificationCenterGetDistributedCenter prototype
CFNotificationCenterRef CFNotificationCenterGetDistributedCenter();
Update:
This function is available in iOS 5.0 and above. If you need to support older versions there are two solutions:
Darwin notification center
CFMessagePort - can transmit arbitary data.
If you really need to support older versions I suggest you using CFMessagePort. It's simple and flexible solution, well documented. If you having troubles with it you can always find working examples.
You can store your var in the keyChain, and make all app which wanna share it in one access group. Hope it help.
I should hook UIResponder of every app, including SpringBoard and any others. In the hooking, I will write something to the specified file. If I set the path to /var/mobile/Library/MyApp, recommended by Cydia, I found that only the SpringBoard and MyApp could write successfully.
So is there a place every app can write and read?
I admit that I'm not 100% sure on this one, but my guess would be no, there is not a path that every app can writes files to on a jailbroken iPhone.
Certainly, jailbreak apps (installed in /Applications/) on a jailbroken phone can write to locations that can be shared between those jailbreak apps. But, as I understand your question, you would like to inject code into normal, App Store apps, so that those apps can also read and write to the shared location. That part I don't think is possible, because jailbreaking does not completely disable the sandbox for 3rd-party apps installed normally, under /var/mobile/Applications/.
Now, there might be a workaround. There are some shared folders that are accessible to all apps for certain purposes. For example, any app can write images to the saved photos album. What you could try is to take the content of the file you want to write, and encode it as fake image data, in a UIImage (e.g. with [UIImage imageWithData:]). You'd probably need to add a valid image header to the data. Then, you save the file to the photos album, using something like
writeImageToSavedPhotosAlbum:orientation:completionBlock:.
Another app could then find the fake photo by enumerating the saved photos album, and then converting the asset back to image representation to pull the real data back out.
However, this seems quite complicated, and possibly wouldn't work (I haven't tried it). Perhaps you could tell us why you want this shared file. Maybe there's a better way to share the data, without using a globally-accessible file?
Notifications can help you with this. Every app will send interprocess notifications about the events. You could start a daemon that will listen for this notifications and save them in a file. Or you could listen for them in SpringBoard as he can write, for example, to /var/mobile/Media. Depends on what you want to do with this file. Check out my answer here How to create a global environment variable that can be accessed by SpringBoard or other applications in the jailbroken iPhone?
I want to write a app to download and manage files from the web.If I just put the file in the Document. Is there any limit of file size or can I load another app to read the file in the Directory?
I don’t think there is a limit to how big a file you can put in your app’s Documents directory other than the amount of free space left on the device.
No, other apps cannot access the contents of your app’s Documents directory—that’s the entire purpose of the sandboxing system. What you can do is use the UIDocumentInteractionController class with a file you’ve downloaded to present the user with a list of apps that can handle opening that file.
The filesystem would limit the size to 4G, but im sure the iOS limits it even further.
No two apps can see each others files, unless the user export/import them via iTunes, or you set the app to be in the list of options when you hold down the link and the "Open In..." popup appears.
Check out the UIDocumentInteractionController Reference.
And UIActionSheetDelegate Reference.
I would like to know if there is any way to detect if the iphone music library has changed when my app is not running.
There is a property lastModifiedDate in MPMediaLibrary class which does this but the problem i am facing is that this date changes even if the iPhone is not synced. The date generally changes if the now playing list or current playing list is changed in iPod.
Is there any other way to detect if the iPhone is synced?
You could use the lastModifiedDate and when the application is closed record the status of the playlists and then when the app is opened and the lastModifiedDate has changed: compare the current and previous playlists.
If a device sync with iTunes, it will clear the tmp folder under all apps.
Therefore you may create a blank file in tmp, and next time when your application launch and found the file is missing, the device should have been synced.
To obtain the tmp folder path, use NSTemporaryDirectory()