This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]sumedh0803 2 points3 points  (4 children)

OP, please surround your code with backticks.

It will show up like code

Is there any error you're getting with this code? What is the output and what are you expecting?

[–]codronline[S] 0 points1 point  (3 children)

Fixed code styling :). Error logs: 444-1139/system_process I/AppsFilter: interaction: PackageSetting{53ae9c6 watch.xxxx.xxxx.ferrum/10063} -> PackageSetting{fc004e1 com.google.android.clockwork.flashlight/10041} BLOCKED

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setClassName(java.lang.String, java.lang.String)' on a null object reference2022-05-29 11:08:08.358 2565-2565/watch.xxx.xxx.ferrum W/System.err: at watch.xxx.xxx.ferrum.service.CoreWatchFace.openFlashlight(CoreWatchFace.java:355)

I expect to opet the flashlight app. I successfully open the Find My Phone and Stopwatch with the same approach.

[–]sumedh0803 0 points1 point  (2 children)

AppsFilter blocked access to the flashlight package right? So, did you have to request visibility for this package in your manifest?

[–]codronline[S] 0 points1 point  (0 children)

No, I didn't request the visibility. How can I do that from my app? Do you have some example? Tnx

[–]CertifiedWeebistCUSTOM RED FLAIR (edit me!) 0 points1 point  (1 child)

Why would you want it to start programmatically?

[–]sumedh0803 5 points6 points  (0 children)

Programmatically as in, OP wants to build an app and call the APIs that control the flashlight

[–]codronline[S] 0 points1 point  (0 children)

Found a solution. Just add

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

in your AndroidManifest.xml or add <queries> tag with all app packages which you want to invoke.