How to Open PDF/File in Ionic on Android

How to Open PDF/File in Ionic on Android?

If you recently tried to open a file in Ionic from the application dir using `fileOpener2` plugin you may have encountered an error `File Not Found` which could indicate permission error.

It turns out you can’t open a file from `applicationDirectory` directly, you have to copy it into another directory:

if (this.platform.is('android')) {
  const self = this;
  const targetFile = self.file.dataDirectory + '/' + yourFileName;
		
  self.file.copyFile(self.file.applicationDirectory + 'www/assets/', yourFileName, 
                     self.file.dataDirectory, yourFileName).
           then(function (res) {
	     self.fileOpener.open(targetFile, 'application/pdf');
	});
}

Install the Cordova Plugin here:

https://github.com/pwlin/cordova-plugin-file-opener2
https://ionicframework.com/docs/native/file-opener

How to install the Android Q beta

The Verge:

If you’re not the kind of person who wants to unlock your phone’s bootloader, I can’t blame you. Google lets Pixel owners enroll in the beta by simply logging in with a Google account, then selecting the compatible device that they’d like to install the beta. You’ll get an over-the-air update that way, just like you normally would for stable versions of Android.

Once you click “Enroll,” you’ll eventually get an update notification on the enrolled device that a system update is ready. You may need to check for a system update in order for it to fetch the beta software, but it usually doesn’t take long for it to be ready for download. (Google says it could take 24 hours or more, but we’ve rarely had to wait that long. The beta hit one of our phones less than a half-hour after enrolling it.) As new Android Q developer previews come out, you’ll get a notification to install them, too, as you would for any regular system update.

Alternatively, you can flash the Android Q beta to your Pixel phone. Google has provided a list of image downloads for the supported phones, but you should only take this road if you’re a developer, or if you just like to do things the hard way. Phones that are updated in this manner won’t receive over-the-air updates to upcoming beta versions, so if you want the latest Android Q features without much hassle, just enroll in the beta instead.

Samsung Galaxy S10 Face Unlock is Not Reliable

Ars Technica reporting:

There are a number of reports that say—surprise!—a 2D image sensor can be fooled by a 2D image. The Verge was able to unlock the device with a video, and YouTube channel Unbox Therapy was able to unlock the S10 just by playing one of its public channel videos in view of the camera. The worst example is probably from AndroidWorld.it, which was able to unlock the Galaxy S10 by waving a still photo around in front of the device.

The Galaxy S10 can also reportedly have trouble telling different people apart. Security Researcher Jane Wong was able to unlock her brother’s phone with her face.

Not surprised.

How To Build Production and Release Version of Ionic App

To make the production and release version of Android app using Ionic run:

ionic cordova build ios --prod --release

This should run the same as the expanded version:

ionic cordova build ios --minifycss --optimizejs --minifyjs --release

You may need to run with sudo in front of the command if you have permission issues.

For iOS builds the –release flag does not seem to do anything in my testing. I could not find any official documentation explaining what this flag does to iOS builds.

For more detail visit the ionic documentation on building
https://ionicframework.com/docs/cli/commands/cordova-build

Android apps send your data to Facebook

The Verge:

Major Android mobile apps from companies including Yelp and Duolingo send data that could be used to personally identify you for ad tracking straight to Facebook immediately upon logging in, according to a new report from the London-based UK charity and watchdog group Privacy International (PI).

This data transfer happens even if a user isn’t logged into Facebook on that device and even in the event the user doesn’t have an active Facebook account at all.

Amazing.