Browsed by
Month: November 2017

Android notify users when app version is updated on play store .

Android notify users when app version is updated on play store .

1 . First get current play store version. int currentVersion,updateVersion; VersionChecker versionChecker = new VersionChecker(); try { String latestVersion = versionChecker.execute().get(); updateVersion = Integer.parseInt(latestVersion.substring(latestVersion.length()-1)); Toast.makeText(HomeActivity.this, latestVersion.toString(), Toast.LENGTH_SHORT).show(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } PackageManager manager = this.getPackageManager(); PackageInfo info = null; try { info = manager.getPackageInfo(this.getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } 2. Get current app version with PackageManager . PackageManager manager = this.getPackageManager(); PackageInfo info = null; try { info…

Read More Read More

Swift 3 / 4 get current location with location manager .

Swift 3 / 4 get current location with location manager .

Step – 1 :  First define LocationManager . And Current location of CLLocaion .   var manager = CLLocationManager() var currentLocation: CLLocation! Step 2 : In ViewDidController get Current location with location manager . That’s it .   manager.requestWhenInUseAuthorization()                  if (CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedWhenInUse ||             CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedAlways){             currentLocation = manager.location             print(“location is “, currentLocation.coordinate.latitude)…

Read More Read More

Swift 3 /4 take photo from camera or gallery and show it .

Swift 3 /4 take photo from camera or gallery and show it .

Step One : First create a project and take imageView and a button to capture image . Connect it to ViewController . Step Two : Copy this code and run . hope it will be done . 😀    class ImageCapture: UIViewController , UIImagePickerControllerDelegate,UIPopoverControllerDelegate,UINavigationControllerDelegate{      @IBOutlet var imageViewWeight: UIImageView!      var imagePicker:UIImagePickerController?=UIImagePickerController() override func viewDidLoad() {         super.viewDidLoad()          imagePicker?.delegate=self     }      @IBAction func takeImage(_ sender: Any) {       var alert…

Read More Read More