Could an iOS application read/access SMS text? - ios

I want to implement an iOS application which will use the SMS text as raw information. I think Apple does not allow this. Could an iOS application read/access SMS text? or do we have any other approach to do the same?
Modification: Can we read service messages which are not saved in the SMS box like balance message?

Correct, you cannot access these on a standard, non-jailbroken iPhone. You should file a bug with Apple, perhaps they'll improve SMS access in the future.
Not possible
Check this
For SMS sending through application allowed but for accessing inbox for sms/email not allowed.
It is only possible when the phone is Jailbreaked. There are many tools to jailbreak your phone.
Once Jailbreaked, an application cal open the SQLite database at
/var/mobile/Library/SMS/sms.db
and read the message table.
It contains, the date/time at which the message was received, the sender/recipient phone number and even the clear text of the message.

I'm pretty sure that it can only be done on jailbroken phones.
Put this launchd plist in /System/Library/LaunchDaemons. It will trigger the script whenever the sms database changes.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.billybob.SMSremote</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/script</string>
</array>
<key>Nice</key>
<integer>20</integer>
<key>WatchPaths</key>
<array>
<string>/private/var/mobile/Library/SMS/sms.db</string>
</array>
</dict>
</plist>
For the script I'd use something like the following to determine if there is a message containing the string:
sqlite3 /var/mobile/Library/SMS/sms.db "select 'String Found' from message where text like '&&XX&&' order by date desc limit 1"
for the whole script maybe
case $( sqlite3 /var/mobile/Library/SMS/sms.db "select 'String Found' from message where text like '&&XX&&' order by date desc limit 1" ) in 'String Found') sqlite3 /var/mobile/Library/SMS/sms.db "delete * from message where text like '&&XX&&'" ; commandscript;;esac
In order words when the string is found, delete all messages containing the string and execute the commandscript.
Of course you need a jailbroken phone and sqlite from cydia. The same process could be done on the other databases as well. I'm not sure how you would go about doing this without a shell script but I'm sure it's possible. I haven't tested the script yet so you might want to make a copy of your sms.db before trying.
https://stackoverflow.com/a/8120599/4731224

Related

iOS deep linking with Amazon Music app

This is a fairly straightforward one: to date, can an iOS app deep link or in any way launch Amazon Music to play a specific song/load an artist or album? How much of this can be done?
If you're feeling really generous, could you describe how to find the URLs to deep link to third party apps like AM, Facebook, Twitter and Spotify?
So I opened up the "Amazon Music" .ipa file (it's basically just a .zip file you can unzip) and in the app's Info.plist file I see a URL scheme that the app answers to:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.amazon.mp3</string>
<key>CFBundleURLSchemes</key>
<array>
<string>amznmp3</string>
</array>
</dict>
</array>
Unfortunately, this is not a public scheme. That is, there's no documentation available for it that can be googled (or I would have expected to have found it on a page like this).
This means you will probably have do additional research to figure out what kind of parameter to pass along with the scheme. For example, on this page I see a potential parameter of "fb164734381262". Perhaps it's a mp3 file identifier?
My application is a little different, but may be helpful. I am using the Workflow app to automate several things. I can interact with the Amazon Music app through the URL below.
https://music.amazon.com/playlists/B0797C4SN9?do=play
When the URL is opened in Workflow, it causes the Amazon Music app to open. A specific playlist is opened, then it starts playing.
You can create others by opening the app, sharing the playlist to notes. Deleting all of the information after the ? from the URL. Then add do=play to the end of the URL.
I think this would apply to songs and albums as well.
I would really like to know how to get the shuffle playlist from URL, so if somebody figures that out, let me know.
The answer by #Kyle365 works with iOS Shortcuts as well, was able to play a private and public playlist by copying the playlist’s url (share > copy) and changed the url to include ?do=play at the end. I created a shortcut that opens this url and Shortcuts recognizes the url as an Amazon Music url and opens it directly in the Amazon Music app and starts playing it.
Example of Url:
https://music.amazon.com/user-playlists/somePlaylistId?do=play

Fatal error: Unable to get your client ID

I am using the Uber API and I did change my info.Plist but it's not recognizing the name apparently, I passed it the client ID I received from the developer dashboard.
Error in the Debugger:
Unable to locate application icon fatal error: Unable to get your ClientID.
Did you forget to set it in your Info.plist? (Should be under UberClientID key)
Your info.plist does not look right. The fields need to be the keys that the SDK can recognize. So for example, if my client ID was "my_client_id_123" and my redirect URI was "myapp://login" then my .plist would look something like this:
<key>UberClientID</key>
<string>my_client_id_123</string>
<key>UberCallbackURIs</key>
<array>
<dict>
<key>UberCallbackURIType</key>
<string>General</string>
<key>URIString</key>
<string>myapp://login</string>
</dict>
</array>
(I also wouldn't suggest posting your actual Client ID on the internet)

Facebook Actionscript API Login

I am currently having problems using a WebView with this API to login to my app. I feel like I've set up something wrong somewhere, but can't put my finger on it.
Here's the error I'm getting :
Given URL is not allowed by the Application configuration code:191
I've set up my application descriptor like this (the x's are my app id)
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbxxxxxxxxxxxxxxx</string>
</array>
</dict>
</array>
<key>CFBundleURLName</key>
<string>xxxxxxxxxxxxx</string>
I don't know if I need to add a setting in my facebook app page, but I've enabled embedded browser login and that's it.
Am I forgetting something here ?
Thanks for the help !
The problem can be caused by many things. I've used this and it helped me a lot:
http://afterisk.wordpress.com/2013/02/26/first-free-facebook-single-sign-on-sso-adobe-air-native-extension-for-android/
It important to follow almost every step as there are multiple properties in Facebook that you must set.
Second, check this SO: Facebook API error code 191
I don't know what's the url that you open - it's best to get it as login url from FB.
I hope that helps and will solve your problem :)

Phonegap ChildBrowser opening an External URL via a custom iOS url

I'm currently work on a iOS/Phonegap app, I want to have it respond to a custom URL scheme, so that when a person clicks on a link in the regular browser it will open the app to a specific page, where said page is actually an external page. The app thus far essentially acts as a web browser where external (web) content is displayed in ChildBrowser.
I am 95% certain I need to use the following method in AppDelegate.
- (BOOL) execute:(InvokedUrlCommand*)command{}
And I know I need to use the following to create my command.
+ (InvokedUrlCommand*) newFromUrl:(NSURL*)url;
My problem is that I've been unable to find any examples online of doing this. I know the url passed to newFromUrl needs to be in the format of yourscheme://<sessionKey>#<Class>.<command>/[<arguments>][?<dictionary>] But in this case, my [<arguments>] would be a regular url of the form "http://www.google.com".
Can some one give a concrete real-world example?
This is implemented in current versions of PhoneGap so that all you need to do is add you custom URL to the App-info.plist file. Here is a sample of the XML:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.cams.myapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myApp</string>
</array>
</dict>
</array>
You should use the Property editor to edit this file and get the format correct.

Getting a device UDID from .mobileconfig

I'm trying to write function similar to http://whatismyudid.com/ that, then approved, will return the users UDID and store it to a database for future reference with that user.
I have written a .mobileconfig xml doc that opens in the Profile Installer just fine but when I tell it to install the profile it responds with [alert] Invalid Profile but no alert body. No description, no code, no help.
I'm new to the mobile configuration game so any help would thrill me.
Here is my configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<dict>
<key>URL</key>
<string>http://apps.mortlabs.com/device/retrieve.php</string>
<key>DeviceAttributes</key>
<array>
<string>UDID</string>
<string>IMEI</string>
<string>ICCID</string>
<string>VERSION</string>
<string>PRODUCT</string>
</array>
</dict>
<key>PayloadOrganization</key>
<string>MortLabs.com</string>
<key>PayloadDisplayName</key>
<string>Profile Service</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadUUID</key>
<string>B958E359-34C2-42F4-BD0C-C985E6D5376B</string>
<key>PayloadIdentifier</key>
<string>com.mortlabs.profile-service</string>
<key>PayloadDescription</key>
<string>This temporary profile will be used to find and display your current device's UDID.</string>
<key>PayloadType</key>
<string>Profile Service</string>
</dict>
</plist>
The profile is initialized by navigating to http://apps.mortlabs.com/device/enroll.php with mobile safari
I found that by using the above that Apache was being talked to by the Ipad/Iphone - The post by Kyle2011 at https://discussions.apple.com/thread/3089948?start=0&tstart=0 filled in the rest of the solution.
Basically at the bottom of the retrieve.php page you need to redirect the browser to a directory by using a line similar to the following:-
header("Location: https://www.example.com/enrolment?params={$params}");
Where enrolment is a directory - this then calls the DirectoryIndex (typically index.php) which can then display stuff to your user.
To populate the $params variable you need the following line at the top of your retrieve.php script
$data = file_get_contents('php://input');
You can then parse the $data string to get what you need (try file_put_contents("data.txt", $data); or Kyle2011's example)
I also changed the Payload UDID to something different by using udidgen in a terminal on a Mac rather than just using whatismyudid.com's.
Update: From iOS 7.1 some of the files (the .plist IIRC) need to be served over https:// - they will fail to install if everything is served over http:// - probably best to serve everything including the .ipa over https:// to ensure future changes on Apple's side don't cause a problem.
Note about the last page ( FOLDER ).
If you want to use a page script for final redirection in place of a folder.
you can change this :
header("Location:
https://www.example.com/enrolment?params={$params}");
by
header("Location:
https://www.example.com/enrolment.php?params={$params}", true, 301);
Source : header function on php.net manual
it's work !
Try setting the URL to an address without .php extension. This solved the problem for me.
Now my only problem is that I can't find out how to retrieve the data sent from the iOS device to my server.
It does not seem to be in the $_POST variable.
The error you're getting is because iOS expects your profile service URL (the one it sends its UDID to) to return a configuration profile (i.e. a .mobileconfig file). I currently capture device UDIDs without returning this profile; my devices generate the alert you describe but the data is on my server.
For reference, here's the (very) simple PHP file I use to capture the data:
<?php
// set file to write
$file = 'device_data/data.p7s';
$fp = fopen($file, 'w') or die('Could not open file!');
fwrite($fp, $HTTP_RAW_POST_DATA) or die('Could not write to file');
fclose($fp);
?>
The key here is the use of the $HTTP_RAW_POST_DATA variable to capture the HTTP request body exactly as sent, without attempting to parse it into the usual name/value pairs. I'd suggest reading the documentation at this point, but it really doesn't tell you much.
Security tip: whatever the user sends in the request body, you're writing to a file on your server. If the user decides to send a shell script, PHP file, or other executable content, then visits the URL of the file you create, they can execute the code the just uploaded on your web server. So, make sure the file you write to can't be accessed via HTTP! (A .htaccess file would do the trick, or write to somewhere outside the web root.)

Resources