Android Question Writing an App to execute a few clicks on the Phone

Sam Koh

Member
Licensed User
Longtime User
Is it possible to write a B4A App to execute several clicks that I will usually do on my phone? e.g. When I am using Goggle Map, I will set the orientation of my phone to "Landscape", set voice Volume to "Maximum", and Brightness to "Auto", before turning on the Goggle Map.

Can I write an App to do the above 3 steps , i.e. Orientation, Volume and Brightness automatically?
 

mangojack

Expert
Licensed User
Longtime User
Is it possible to write a B4A App to execute several clicks that I will usually do on my phone?
Yes.

Can I write an App to do the above 3 steps , i.e. Orientation, Volume and Brightness automatically?
Yes

See what you can do using the Phone Library...



B4X:
    Dim  p As Phone
    p.SetVolume(p.VOLUME_MUSIC, 15, True)    'Max Volume
    p.SetScreenOrientation(0)        ' Landscape                
    p.SetScreenBrightness(1)            ' (-1 Auto did not work , 1 Brightest did work) should it be Adaptive now ???


just type "p." to display IntelliSense for Method Parameters



(you might need to read up on Permissions and requesting RuntimePermissions)

Have a play with the above, then start a separate new post for any problems you encounter.


Eventually you could also include Google Maps directly within your App.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i think op may find that the settings are temporary (valid for the duration of his app), the exception being for brightness, which requires a systems permission to work across apps.
 
Upvote 0

Sam Koh

Member
Licensed User
Longtime User
As pointed out by drgottjr and showed in my test, the "p." settings are only applicable within the App itself, they do not change the global setting of my phone. e.g. the orientation is Landscape within the App, but it is still Portrait in the phone
Is there a way to effect the settings in the phone environment?
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I think that common sense says that no app can force "the phone" to be in (say) landscape mode because that would completely disable apps that were fixed in portrait mode. Of course, common sense does not always work with Google.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
you're asking the same question. the phone library is not to blame. user-written app settings are user-written app-related.

what you want is not what google has in mind. i realize you may want simply to automate something
for your own personal use, but from google's point of view, allowing you to control system settings
from an app would allow you or any other developer to control what a user sees, hears and does in
spite of what they may want to see, hear or do. that level of arrogance is, of course, reserved
by google for its own personal use.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
i think op may find that the settings are temporary (valid for the duration of his app), the exception being for brightness, which requires a systems permission to work across apps.
Lying in bed many hours later I realised that fact, but the OP has already been updated by much wiser people.
 
Upvote 0

Sam Koh

Member
Licensed User
Longtime User
Using Personal Computer as a comparison, a few clicks of the keystrokes on the computer can be easily replaced by a batch file or auto-click software like "AutoIt". I am looking for an equivalent capability in B4X
The change in phone settings only affect my own phone, and I can of course reverse the settings back to default
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…