Checking if 'Unknown sources' is checked

DKCERT

Member
Licensed User
Longtime User
Is it possible to check if "unknown sources" has been checked (set to true) using B4A code?
 
No need for reflection, just use the phone library ie

Dim ph as Phone

if ph.GetSettings("install_non_market_apps") = 1 then 'can install from other sources

bluejay
 
Upvote 0
Thanks Moster67,

I have this Sub...

Code: Copy
Sub GetAndroidId As String
   Dim p As Phone
   Return p.GetSettings("android_id")   
End Sub

... that I changed to this:

Code: Copy
Sub GetAndroidUnknownSourceStatus As String
   Dim p As Phone
   Return p.GetSettings("install_non_market_apps")   
End Sub

It seems to work :)
 
Upvote 0
Argh BlueJay... I had the edit window open and didn't see your post. Thanks a lot - that confirms my own code triggered by Moster67 :)

No need for reflection, just use the phone library ie

Dim ph as Phone

if ph.GetSettings("install_non_market_apps") = 1 then 'can install from other sources

bluejay
 
Upvote 0
Great! I was not even aware about the GetSettings-method. Thanks.

No need for reflection, just use the phone library ie

Dim ph as Phone

if ph.GetSettings("install_non_market_apps") = 1 then 'can install from other sources

bluejay
 
Upvote 0
This post helps me a lot
And if the value is false "cannot install from unknown sources", how to call up the option setup page for user to change this option?

Thanks Moster67,

I have this Sub...

Code: Copy
Sub GetAndroidId As String
   Dim p As Phone
   Return p.GetSettings("android_id")  
End Sub

... that I changed to this:

Code: Copy
Sub GetAndroidUnknownSourceStatus As String
   Dim p As Phone
   Return p.GetSettings("install_non_market_apps")  
End Sub

It seems to work :)
 
Upvote 0
Back
Top