Last active
August 18, 2017 17:39
-
-
Save adamtarmstrong/a06e52e831428cdb81f1dc2f876f3f67 to your computer and use it in GitHub Desktop.
YouVersion Event - Deep-Link (Cross-Platform)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* You Version Sample Event URL: http://bible.com/events/264769 | |
*/ | |
var sermonNoteURL = "youversion://events?id=" + eventID; //where eventID = 6 digit from YouVersion Event URL | |
openYouVersionSermonNotes(sermonNoteURL); | |
function openYouVersionSermonNotes(eventURL){ | |
if (OS_ANDROID){ | |
try { | |
var intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_VIEW, | |
data: eventURL | |
}); | |
Ti.Android.currentActivity.startActivity(intent); | |
} catch (e){ | |
//present App Download Option | |
} | |
} else { | |
if (Ti.Platform.canOpenURL(eventURL)){ | |
Ti.Platform.openURL(eventURL); | |
} else { | |
//present App Download Option | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment