/thereisonlywe-quran

A complete, open-source and easy-to-use Quran text API to be used in Java and Android programming.

Primary LanguageJavaApache License 2.0Apache-2.0

Installation is very straight forward; just add .jar files inside "bin" directory as libraries to your project and you are all set. Below are some examples of usage:


Mushaf:

  1. Set Mushaf (one of MUSHAF_SIMPLIFIED, MUSHAF_UTHMANI, MUSHAF_ENGLISH_LITERAL) Quran.setMushaf(Quran.MUSHAF_SIMPLIFIED);
  2. Download it (or skip this step and have it downloaded automatically when required) QuranicTextManager.updateText(Quran.MUSHAF_SIMPLIFIED);
  3. Optional: Load Mushaf into memory for faster access (skip this step on Android to preserve memory) Quran.load();
  4. Get verse/ayah Quran.getVerseContent(0);

Translations and other texts:

  1. Check required resources
boolean b = QuranicTextManager.init();
  1. Get texts list (type, minimum completion percent, language code)
List<QuranicTextIdentifier> qti = QuranicTextManager.getTextsOnServer(QuranicTextType.TRANSLATION_TEXT, 100, "en");

or get a list of locally available (already downloaded) texts

List<QuranicTextIdentifier> qti = QuranicTextManager.getLocalTexts();
  1. Add returned texts to the provided ordered list
for (int i = 0; i < qti.size(); i++)
  QuranicTextList.addText(qti.get(i).getID());
  1. Get a text
QuranicText qtxt = QuranicTextList.getTextByOrder(0);
  1. Download the text and make its content available offline
QuranicTextManager.updateText(qtxt.getIdentifier().getID());
  1. Get text content
qtxt.getVerseContent(Quran.getVerse(Quran.SECTION_COUNT, 1));

Bookmarks:

QuranicBookmarkList qbl = new QuranicBookmarkList(); //create a bookmark list
qbl.addBookmark(new QuranicBookmark(Quran.getRandomVerse(), "some random verse")); //add a bookmark to the list
QuranicBookmarkManager.createNewFileAndWrite(new File("random bookmarks list"), qbl.getBookmarks()); //save list to file
QuranicBookmark[] readBookmarks = QuranicBookmarkManager.getBookmarks(new File("another bookmarks list")); //read bookmarks from file
qbl.clearBookmarks();
qbl.addBookmarks(readBookmarks); //add read bookmarks to the list
qbl.getBookmark(0); //get first bookmark

Required permissions on Android:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

You can also use this library to find similar verses to a particular one, find section/surah names and meanings, check for prostration verses etc. Check "doc" folder for a complete methods overview.