This file contains 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
int pAccessFineLocation = | |
ContextCompat.checkSelfPermission( | |
context, Manifest.permission.ACCESS_FINE_LOCATION); | |
int pAccessCoarseLocation = | |
ContextCompat.checkSelfPermission( | |
context, Manifest.permission.ACCESS_COARSE_LOCATION); | |
if (pAccessFineLocation == PackageManager.PERMISSION_GRANTED | |
&& pAccessCoarseLocation == PackageManager.PERMISSION_GRANTED) { | |
//Yay! We have permission! |
This file contains 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
/** | |
* Returns the installed application list on the device. | |
* @param activity Activity. | |
* @return Returns List<ApplicationInfo>. | |
*/ | |
public static List<ApplicationInfo> getInstalledApplicationList(Activity activity, boolean printToConsole) { | |
final PackageManager pm = activity.getPackageManager(); | |
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA); | |
if (!printToConsole) return packages; |
This file contains 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
private static final double KAABA_LONGITUDE = 39.826228; | |
private static final double KAABA_LATITUDE = 21.422305; | |
private double getQiblaAngele(double myLatitude, double myLongitude) { | |
double sinMyLoMinusQLo = Math.sin(myLongitude - KAABA_LONGITUDE); | |
double cosMyLat = Math.cos(myLatitude); | |
double tanQLat = Math.tan(KAABA_LATITUDE); | |
double sinMyLat = Math.sin(myLatitude); | |
double cosMyLoMinusQlo = Math.cos(myLongitude - KAABA_LONGITUDE); |