Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26532] Android: Add canRequestPackageInstalls to Ti.Android

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, canRequestPackageInstalls, permissions
ReporterDavid van de Meer
AssigneeEric Merriman
Created2018-11-07T02:37:01.000+0000
Updated2018-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?

Comments

  1. Sharif AbuDarda 2018-11-07

    Hello, Thanks for the request. Our engineers will look into it.

JSON Source