Zack Li
commited on
Commit
•
d2d36e6
1
Parent(s):
7d7e8ff
Update android function readme
Browse files- android_functions.txt +33 -49
android_functions.txt
CHANGED
@@ -1,82 +1,73 @@
|
|
1 |
-
def take_a_photo(camera
|
2 |
"""
|
3 |
Captures a photo using the specified camera and resolution settings.
|
4 |
|
5 |
Parameters:
|
6 |
-
- camera (str
|
7 |
-
- resolution (str, optional): Sets the photo resolution. Options include '720p', '1080p', and '4K'. The default is '1080p'. Optional to provide.
|
8 |
|
9 |
Returns:
|
10 |
- str: The string contains the file path of the captured photo if successful, or an error message if not. Example: '/storage/emulated/0/Pictures/MyApp/IMG_20240310_123456.jpg'
|
11 |
"""
|
12 |
|
13 |
|
14 |
-
def get_trending_news(
|
15 |
"""
|
16 |
-
|
17 |
|
18 |
Parameters:
|
19 |
-
-
|
20 |
-
-
|
21 |
-
- language (str, optional): ISO 639-1 language code for article language, by default uses 'en'. Optional to provide.
|
22 |
-
- max_results (int, optional): Maximum number of articles to return, by default, uses 5. Optional to provide.
|
23 |
|
24 |
Returns:
|
25 |
-
- list[str]: A list of strings, each
|
26 |
"""
|
27 |
|
28 |
|
29 |
-
def get_weather_forecast(location
|
30 |
"""
|
31 |
Provides a weather forecast for a specified location over a given number of days. Each day's forecast includes a brief description of the expected weather conditions.
|
32 |
|
33 |
Parameters:
|
34 |
- location (str): The location for which the weather forecast is desired. Can be a city name, ZIP code, or other location identifiers.
|
35 |
-
- days (int, optional): The number of days to include in the forecast, starting from today. The default is 1 day. Optional to provide.
|
36 |
|
37 |
Returns:
|
38 |
- list[str]: A list of strings, each representing the weather forecast for one day. Each string includes the date and a brief description of the weather conditions. Formatted in 'YYYY-MM-DD: Description' format.
|
39 |
"""
|
40 |
|
41 |
|
42 |
-
def send_email(recipient,
|
43 |
"""
|
44 |
-
Sends an email with
|
45 |
|
46 |
Parameters:
|
47 |
-
- recipient (str):
|
48 |
-
-
|
49 |
-
-
|
50 |
-
- attachments (list of str, optional): A list of file paths representing files to attach to the email. Defaults to None, indicating no attachments. Optional to provide.
|
51 |
-
- cc (list of str, optional): A list of email addresses to include in the Carbon Copy (CC) field. Defaults to None. Optional to provide.
|
52 |
-
- bcc (list of str, optional): A list of email addresses to include in the Blind Carbon Copy (BCC) field. Defaults to None. Optional to provide.
|
53 |
|
54 |
Returns:
|
55 |
"""
|
56 |
|
57 |
|
58 |
-
def search_youtube_videos(query
|
59 |
"""
|
60 |
Searches YouTube for videos matching a query.
|
61 |
|
62 |
Parameters:
|
63 |
- query (str): Search query.
|
64 |
-
- max_results (int, optional): Maximum number of search results, by default, use 10. Optional to provide.
|
65 |
-
- search_filter (enum, optional): Filter for search results, chosen from 'Relevance', 'Upload date', 'View Count', 'Rating'. By default, use 'Relevance'. Optional to provide.
|
66 |
|
67 |
Returns:
|
68 |
- list[str]: A list of strings, each string includes video names and URLs.
|
69 |
"""
|
70 |
|
71 |
|
72 |
-
def find_route_google_maps(origin, destination, mode
|
73 |
"""
|
74 |
Computes a route using Google Maps from an origin to a destination.
|
75 |
|
76 |
Parameters:
|
77 |
- origin (str): Starting location.
|
78 |
- destination (str): Target location.
|
79 |
-
- mode (enum
|
80 |
|
81 |
Returns:
|
82 |
- List[str]: The string provides the route details.
|
@@ -99,7 +90,7 @@ def send_text_message(contact_name, message):
|
|
99 |
Sends a text message to the specified contact.
|
100 |
|
101 |
Parameters:
|
102 |
-
- contact_name (str): The name of the recipient contact.
|
103 |
- message (str): The content of the message to be sent. This is what the recipient will receive.
|
104 |
|
105 |
Returns:
|
@@ -111,35 +102,31 @@ def make_phone_call(phone_number):
|
|
111 |
Initiates a phone call to the given phone number. It can handle both international and domestic numbers.
|
112 |
|
113 |
Parameters:
|
114 |
-
- phone_number (str):
|
115 |
|
116 |
Returns:
|
117 |
"""
|
118 |
|
119 |
|
120 |
-
def create_contact(name, phone_number
|
121 |
"""
|
122 |
Creates a new contact entry in the device's address book.
|
123 |
|
124 |
Parameters:
|
125 |
-
- name (str): Full name of the contact.
|
126 |
-
- phone_number (str):
|
127 |
-
- email (str, optional): Email address of the contact, default is None, optional to provide.
|
128 |
-
- organization (str, optional): Associated organization name, default is None, optional to provide.
|
129 |
-
- notes (str, optional): Additional notes or comments, default is None, optional to provide.
|
130 |
|
131 |
Returns:
|
132 |
"""
|
133 |
|
134 |
|
135 |
-
def set_timer_alarm(time,
|
136 |
"""
|
137 |
Sets a timer or alarm for a specified time.
|
138 |
|
139 |
Parameters:
|
140 |
- time (str): Alarm time in "HH:MM" 24-hour format. For example, "07:12" for 7:12 AM.
|
141 |
-
-
|
142 |
-
- label (str, optional): Custom label for the alarm, default is None, optional to provide.
|
143 |
|
144 |
Returns:
|
145 |
"""
|
@@ -156,7 +143,7 @@ def change_screen_brightness(level):
|
|
156 |
"""
|
157 |
|
158 |
|
159 |
-
def create_calendar_event(title, start_time, end_time
|
160 |
"""
|
161 |
Schedules a new event in the calendar.
|
162 |
|
@@ -164,32 +151,30 @@ def create_calendar_event(title, start_time, end_time, location=None, descriptio
|
|
164 |
- title (str): Event title.
|
165 |
- start_time (str): Event start time as a string in ISO 8601 format "YYYY-MM-DD-HH-MM". For example, "2022-12-31-23-59" for 11:59 PM on December 31, 2022.
|
166 |
- end_time (str): Event end time as a string in ISO 8601 format "YYYY-MM-DD-HH-MM". Must be after start_time. For example, "2023-01-01-00-00" for 12:00 AM on January 1, 2023.
|
167 |
-
- location (str, optional): Location of the event. The default is None, optional to provide.
|
168 |
-
- description (str, optional): Detailed event description. The default is None, optional to provide.
|
169 |
|
170 |
Returns:
|
171 |
"""
|
172 |
|
173 |
|
174 |
-
def set_volume(level, volume_type
|
175 |
"""
|
176 |
-
Sets the volume level for a specified type
|
177 |
|
178 |
Parameters:
|
179 |
- level (int): Target volume level, from 0 (mute) to 10 (maximum).
|
180 |
-
- volume_type (enum): The category of volume to adjust, select from
|
181 |
|
182 |
Returns:
|
183 |
"""
|
184 |
|
185 |
|
186 |
-
def connect_to_bluetooth_device(device_name, timeout
|
187 |
"""
|
188 |
Attempts to connect to a specified Bluetooth device within a given timeout.
|
189 |
|
190 |
Parameters:
|
191 |
- device_name (str): The name of the Bluetooth device to connect to.
|
192 |
-
- timeout (int
|
193 |
|
194 |
Returns:
|
195 |
- bool: Returns True if the device was successfully connected within the timeout period, False otherwise.
|
@@ -218,26 +203,25 @@ def set_nest_temperature(target_temperature):
|
|
218 |
"""
|
219 |
|
220 |
|
221 |
-
def play_music_on_nest_hub(music_service,
|
222 |
"""
|
223 |
Streams music on a Google Nest Audio device from a specified service.
|
224 |
|
225 |
Parameters:
|
226 |
- music_service (str): Music streaming service name.
|
227 |
-
-
|
228 |
|
229 |
Returns:
|
230 |
"""
|
231 |
|
232 |
|
233 |
-
def play_video_on_nest_hub(video_service,
|
234 |
"""
|
235 |
Streams video on a Google Nest Hub device from a specified service.
|
236 |
|
237 |
Parameters:
|
238 |
- video_service (str): Video streaming service name.
|
239 |
-
-
|
240 |
-
- resolution (enum, optional): Desired video resolution, chosen from '360p', '720p', '1080p', '2K', '4K'. default is '1080p', optional to provide.
|
241 |
|
242 |
Returns:
|
243 |
"""
|
|
|
1 |
+
def take_a_photo(camera):
|
2 |
"""
|
3 |
Captures a photo using the specified camera and resolution settings.
|
4 |
|
5 |
Parameters:
|
6 |
+
- camera (str): Specifies the camera to use. Can be 'front' or 'back'. The default is 'back'.
|
|
|
7 |
|
8 |
Returns:
|
9 |
- str: The string contains the file path of the captured photo if successful, or an error message if not. Example: '/storage/emulated/0/Pictures/MyApp/IMG_20240310_123456.jpg'
|
10 |
"""
|
11 |
|
12 |
|
13 |
+
def get_trending_news(query, language):
|
14 |
"""
|
15 |
+
Retrieves a collection of trending news articles relevant to a specified query and language.
|
16 |
|
17 |
Parameters:
|
18 |
+
- query (str): Topic for news articles.
|
19 |
+
- language (str): ISO 639-1 language code. The default language is English ('en'), but it can be set to any valid ISO 639-1 code to accommodate different language preferences (e.g., 'es' for Spanish, 'fr' for French).
|
|
|
|
|
20 |
|
21 |
Returns:
|
22 |
+
- list[str]: A list of strings, where each string represents a single news article. Each article representation includes the article's title and its URL, allowing users to easily access the full article for detailed information.
|
23 |
"""
|
24 |
|
25 |
|
26 |
+
def get_weather_forecast(location):
|
27 |
"""
|
28 |
Provides a weather forecast for a specified location over a given number of days. Each day's forecast includes a brief description of the expected weather conditions.
|
29 |
|
30 |
Parameters:
|
31 |
- location (str): The location for which the weather forecast is desired. Can be a city name, ZIP code, or other location identifiers.
|
|
|
32 |
|
33 |
Returns:
|
34 |
- list[str]: A list of strings, each representing the weather forecast for one day. Each string includes the date and a brief description of the weather conditions. Formatted in 'YYYY-MM-DD: Description' format.
|
35 |
"""
|
36 |
|
37 |
|
38 |
+
def send_email(recipient, title, content):
|
39 |
"""
|
40 |
+
Sends an email to a specified recipient with a given title and content.
|
41 |
|
42 |
Parameters:
|
43 |
+
- recipient (str): The email address of the recipient.
|
44 |
+
- title (str): The subject line of the email. This is a brief summary or title of the email's purpose or content.
|
45 |
+
- content (str): The main body text of the email. It contains the primary message, information, or content that is intended to be communicated to the recipient.
|
|
|
|
|
|
|
46 |
|
47 |
Returns:
|
48 |
"""
|
49 |
|
50 |
|
51 |
+
def search_youtube_videos(query):
|
52 |
"""
|
53 |
Searches YouTube for videos matching a query.
|
54 |
|
55 |
Parameters:
|
56 |
- query (str): Search query.
|
|
|
|
|
57 |
|
58 |
Returns:
|
59 |
- list[str]: A list of strings, each string includes video names and URLs.
|
60 |
"""
|
61 |
|
62 |
|
63 |
+
def find_route_google_maps(origin, destination, mode):
|
64 |
"""
|
65 |
Computes a route using Google Maps from an origin to a destination.
|
66 |
|
67 |
Parameters:
|
68 |
- origin (str): Starting location.
|
69 |
- destination (str): Target location.
|
70 |
+
- mode (enum): Mode of transportation, options include 'driving', 'walking', 'bicycling', and 'transit'. The default mode is 'driving'.
|
71 |
|
72 |
Returns:
|
73 |
- List[str]: The string provides the route details.
|
|
|
90 |
Sends a text message to the specified contact.
|
91 |
|
92 |
Parameters:
|
93 |
+
- contact_name (str): The name of the recipient contact.
|
94 |
- message (str): The content of the message to be sent. This is what the recipient will receive.
|
95 |
|
96 |
Returns:
|
|
|
102 |
Initiates a phone call to the given phone number. It can handle both international and domestic numbers.
|
103 |
|
104 |
Parameters:
|
105 |
+
- phone_number (str): phone number of the contact. The phone number should be provided in a standard format, preferably in E.164 format (e.g., +12345678900 for an international format).
|
106 |
|
107 |
Returns:
|
108 |
"""
|
109 |
|
110 |
|
111 |
+
def create_contact(name, phone_number):
|
112 |
"""
|
113 |
Creates a new contact entry in the device's address book.
|
114 |
|
115 |
Parameters:
|
116 |
+
- name (str): Full name of the contact. This should include first and last name.
|
117 |
+
- phone_number (str): phone number of the contact. The phone number should be provided in a standard format, preferably in E.164 format (e.g., +12345678900 for an international format).
|
|
|
|
|
|
|
118 |
|
119 |
Returns:
|
120 |
"""
|
121 |
|
122 |
|
123 |
+
def set_timer_alarm(time, label):
|
124 |
"""
|
125 |
Sets a timer or alarm for a specified time.
|
126 |
|
127 |
Parameters:
|
128 |
- time (str): Alarm time in "HH:MM" 24-hour format. For example, "07:12" for 7:12 AM.
|
129 |
+
- label (str): Custom label for the alarm, default is "alarm".
|
|
|
130 |
|
131 |
Returns:
|
132 |
"""
|
|
|
143 |
"""
|
144 |
|
145 |
|
146 |
+
def create_calendar_event(title, start_time, end_time):
|
147 |
"""
|
148 |
Schedules a new event in the calendar.
|
149 |
|
|
|
151 |
- title (str): Event title.
|
152 |
- start_time (str): Event start time as a string in ISO 8601 format "YYYY-MM-DD-HH-MM". For example, "2022-12-31-23-59" for 11:59 PM on December 31, 2022.
|
153 |
- end_time (str): Event end time as a string in ISO 8601 format "YYYY-MM-DD-HH-MM". Must be after start_time. For example, "2023-01-01-00-00" for 12:00 AM on January 1, 2023.
|
|
|
|
|
154 |
|
155 |
Returns:
|
156 |
"""
|
157 |
|
158 |
|
159 |
+
def set_volume(level, volume_type):
|
160 |
"""
|
161 |
+
Sets the volume level for a specified type : "ring" , "media" , "alarm".
|
162 |
|
163 |
Parameters:
|
164 |
- level (int): Target volume level, from 0 (mute) to 10 (maximum).
|
165 |
+
- volume_type (enum): The category of volume to adjust, select from "ring" , "media" , "alarm".
|
166 |
|
167 |
Returns:
|
168 |
"""
|
169 |
|
170 |
|
171 |
+
def connect_to_bluetooth_device(device_name, timeout):
|
172 |
"""
|
173 |
Attempts to connect to a specified Bluetooth device within a given timeout.
|
174 |
|
175 |
Parameters:
|
176 |
- device_name (str): The name of the Bluetooth device to connect to.
|
177 |
+
- timeout (int): The maximum time, in seconds, to attempt a connection. The default is 10 seconds.
|
178 |
|
179 |
Returns:
|
180 |
- bool: Returns True if the device was successfully connected within the timeout period, False otherwise.
|
|
|
203 |
"""
|
204 |
|
205 |
|
206 |
+
def play_music_on_nest_hub(music_service, music_name):
|
207 |
"""
|
208 |
Streams music on a Google Nest Audio device from a specified service.
|
209 |
|
210 |
Parameters:
|
211 |
- music_service (str): Music streaming service name.
|
212 |
+
- music_name (str): Playlist name to play.
|
213 |
|
214 |
Returns:
|
215 |
"""
|
216 |
|
217 |
|
218 |
+
def play_video_on_nest_hub(video_service, video_name):
|
219 |
"""
|
220 |
Streams video on a Google Nest Hub device from a specified service.
|
221 |
|
222 |
Parameters:
|
223 |
- video_service (str): Video streaming service name.
|
224 |
+
- video_name (str): Video playlist name to play.
|
|
|
225 |
|
226 |
Returns:
|
227 |
"""
|