[TIMOB-26532] Android: Add canRequestPackageInstalls to Ti.Android
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | android, canRequestPackageInstalls, permissions |
Reporter | David van de Meer |
Assignee | Eric Merriman |
Created | 2018-11-07T02:37:01.000+0000 |
Updated | 2018-11-07T23:34:33.000+0000 |
Description
Hi, this is a enhancement request for the Ti.Android SDK module.
Since Android 8 (Oreo) when an app wants to install a APK (Update itself or another app) it requires some extra permission and steps as highlighted here:
https://android-developers.googleblog.com/2017/08/making-it-safer-to-get-apps-on-android-o.html
Part of that process is checking if the app currently has the settings enabled for "Install Unknown Sources" for the app - to check for this one uses "canRequestPackageInstalls"
https://developer.android.com/reference/android/content/pm/PackageManager#canRequestPackageInstalls()
This is not currently built into the Ti.Android SDK module to my knowledge (maybe I missed it?)
I was able to get what I need with Hyperloop but it would be good if this was built into the SDK
Here is my Hyperloop code:
var activity = require('android.app.Activity');
var currentActivity = new activity(Ti.Android.currentActivity);
var canRequestPackageInstalls = currentActivity.getPackageManager().canRequestPackageInstalls();
Ti.API.info("canRequestPackageInstalls");
Ti.API.info(canRequestPackageInstalls);
Can we get this added to the Ti.Android SDK Module?
Hello, Thanks for the request. Our engineers will look into it.