Welcome to Intentsiti!

Intentsiti is a helper app - by itself, it does almost nothing. But when called upon by another app using the Android Intent mechanism, it allows that app access to various bits of data from your device.

It was primarily designed to extend the capabilities of the MIT App Inventor 2 framework. This is a massively fun, fast, easy way to create apps, but it has some limitations on what it can know about the device it's running on.

So I decided to utilize the system built-in to Android, and create an external component that AI2 apps can call on for support.

Other Android apps and programming tools, such as SL4A , should be able to use it as well. All it takes is the ability to generate an Explicit Intent. Intentsiti sends the results back to the calling app as an easy-to-parse text string.

The minimal user interface is only used to change Intentsity settings, and access the extensive documentation (this page). Otherwise, it runs in the background of your apps, silently providing them with information.

Intentsiti consists of a number of modules each returning a specific type of data. Selecting a module is as easy as putting it's name in the Intent with setData(), and any required parameters in the Extra() data.

This is a work in progress - more modules with more capbilities will be added in future versions.

Using Intentsiti

Intentsiti is really designed to be called from other apps, not run directly by the user. However, it does have a minimal user interface with exactly two options.

Pressing the Documentation button gets you here - the help pages. Press the Backbutton to return to the main screen.

Press the Settings button to bring up a page of settings that you can change to control aspects of Intentsiti. Some of the information that may be returned to apps might be sensitive - such as the device phone number. You might not want this available to just any app or web script. So you can disable those information commands here.

As of this version, these settings apply globally, to all apps. A future update will allow you to control the capabilities on a pre-app basis.

Calling Intentsiti From Other Apps

For example, to get the version of Android that you are currently running on from another Java app:

Intent i = new Intent(this, com.closecrowd.intentsiti.Main);
i.setData(Uri.parse("android"));
i.putExtra("key", "build");
startActivityForResult(i);

This Java example calls the "android" module, passing it the Extra key "key" and the Extra data "build". This will return the Android internal version number as Extra() data with the key "result". Here's how you would read it:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (data.hasExtra("result")) {
Toast.makeText(this, data.getExtras().getString("result"),
Toast.LENGTH_SHORT).show();
}
}
}

If you are using App Inventor 2, use the ActivityStarter Component filled in like this:

Action

android.intent.action.MAIN

ActivityClass

com.closecrowd.intentsiti.Main

ActivityPackage

com.closecrowd.intentsiti

DataType

(leave blank)

DataUri

android

ExtraKey

key

ExtraValue

build

ResultName

result

Make your request with the "StartActivity" block, and process the results with the "AfterActivity" block. The "Result" block will then contain the Android version number results.

Note that the "ExtraKey" and "ExtraValue" boxes will differ depending on which Module you set in the DataUri box, and the parameters you are passing to Intentsiti.

Intentsiti may also be called from a scripting language such as Python. Here's a simple example in Python that prints the current WiFi information:

import android
droid = android.Android()

uri="network"
action="android.intent.action.MAIN"
clsname="com.closecrowd.intentsiti.Main"
pkgname="com.closecrowd.intentsiti"
extras = {"key":"wifi"}

res = droid.startActivityForResult(action, uri, None, extras, pkgname, clsname).result
print res

Intentsiti Results

Intentsiti always sends back it's response in the form of a comma (,) separated text string. This is easy to parse into a list or array of items in most programming languages, including AI2.

The first element in the list is always the response code. A 0 (zero) indicates a successful invocation of Intentsiti. It does not always mean that your requested data was available, just that you sent a proper request.

For instance, the "build" command above might return this:

0,19
indicating that this device is runnning Android 4.4.2 (KitKat).

A list of possible response codes is here:


Intentsiti Modules and Parameters

Here are the currently supported modules and their associated request parameters. Remember that the Module name goes in the Intent Data() field, and the parameters in the Extra() fields.

ModuleExtraKeyExtraData
version (leave empty) (leave empty)
Returns: The current Intentsiti app version number. For eaxmple:

0,1.0
-
modules (leave empty) (leave empty)
Returns: A list of current Intentsiti modules. For eaxmple:

0,android,network,fileinfo,dirlist,version,modules

(The last 2 are pseudo-modules that return global information)
-
androidkeycommands
Returns:A list of the commands supported by the android module
androidkeybuild
Returns:The Android version of this device (build number)
androidkeycameras
Returns:The number of cameras on this device
androidkeyid
Returns:The Android ID of this device. This is a 64-bit number (as a hex string) that should be randomly generated on the device's first boot and should remain constant for the lifetime of the device. The value may change if a factory reset is performed on the device. This number is not guaranteed to be unique on all Android devices from all manufacturers. For example:

0,c0b3ee25d186c6b2
androidkeyuuid
Returns:A string in UUID format that uniquely identifies this particular device. This UUID is generated from a hash of the Android ID and the device Telephone ID. For example:

0,00000000-15f1-16d2-14f4-0a0f1043c386

Note: Uniqueness is a goal, not a guarantee, but this value may be more useful than the plain Android ID.
androidkeybattery
Returns:Battery/power status. The elements returned are: status,% charged,source,temperature (C),voltage,technology. For example:

0,full,100.0,USB,29.0,4.269,Li-ion

This device is fully charged (100%), plugged into USB, battery temp is 29.0C, voltage is 4.269 volts, and it's using a Li-Ion battery.

Possible values:

Status: full, charging, discharging, steady, unknown
Source: AC, USB, Wireless, (a numeric code indicating an unknown source)
androidkeysdroot
Returns:The path to the root of the SD card (real or emulated)
androidkeysdstatus
Returns:A string indicating the state of the external SD storage device

Possible values: mounted, mounted_ro, shared, unmounted, checking, removed, unmountable, nofs, bad_removal, unknown
androidkeyextstorage
Returns:A list with info about the external storage on this device: full path,state,removable flag,emulated flag. For example:

0,/mnt/sdcard,mounted,1,-1

Possible values:

State: mounted, mounted_ro, shared, unmounted, checking, removed, unmountable, nofs, bad_removal, unknown
Removable: 1 if removable (SD card), 0 if not (built-in)
Emulated: 1 if emulated (built-in), 0 if removable (SD card), -1 if unknown (Android build 17 or less)
-
dirlistpath/path
Returns:A list of files and directories at this point in the filesystem. Directory names end with "/"
-
fileinfopath/path/filename
Returns:A list of stats on the specified file or dir. Elements returned for a file are: flags,file size,last modified timestamp (in seconds). Elements for a directory are: flags,bytes occupied on this filesystem, bytes free,full path.

Flags are a 3-character string indicating type ("d" for directory, "-" for file), read permission ("r" read okay, "-" no read), and write permission ("w" writeable, "-" no write). For example:

dr- - Path is a diectory, and is read-only
-rw - Path is a file, and is read-write
-
networkkeywifi
Returns:A list with information about the current WiFi state. Elements are: wifi status,SSID,BSSID,network ID,link speed (Mbps),signal strength
For example:

0,disabled,disconnected,00:00:00:00:00:00,-1,-1,-200

or 0,enabled,MyWiFi,00:40:0d:25:b8:3d,1,54,-61

Possible values:

Wifi status: enabled, disabled
SSID: disconnected indicates no WiFi connection
BSSID: 00:00:00:00:00:00 indicates no connection
networkkeywifiinfo
Returns: A list with information about the device WiFi adapter. This command may be disabled via the Intentsiti Settings. Elements are: MAC address,Wifi IP address
For example:

0,00:00:00:00:00:00,0.0.0.0

or 0,91:02:DA:95:30:71,192.168.1.2

Possible values:

MAC address: 00:00:00:00:00:00 indicates WiFi is disabled
IP address: 0.0.0.0 indicates no IP assigned
networkkeyphone
Returns:A list with information about the current phone state. Elements are: type,call state,data state,data activity,phone ID (i.e. IMEI/ESN/MEID), subscriber ID (i.e. IMSI),phone number
For example:

0,GSM,Idle,Connected,None,unavailable
or
0,CDMA,Idle,Disconnected,None,unavailable

Possible values:

Type: None, GSM, CDMA, SIP, Other
Call state: Idle, Ringing, Offhook, Other
Data state: Disconnected, Connecting, Connected, Suspended, Other
Data activity: None, In, Out, InOut, Dormant, Other
networkkeyphoneinfo
Returns:A list with information about the current phone device. This command may be disabled via the Intentsiti Settings. Elements are: phone ID (i.e. IMEI/ESN/MEID),software version (IMEI/ISV), subscriber ID (i.e. IMSI),phone number (MSISDN)

For example:

0,000000000000000,unknown,unknown,15555215554
or
0,c1000030be78ba,unknown,unknown,unknown

Possible values:

ID: unknown indicates element is not available


Intentsiti Response Codes

This table lists the codes returned as the first element of every response from Intentsiti. Some codes indicate a problem with your request (invalid command name or missing data, for instance), and some indicate a problem actually accessing the data.

CodeMeaning
0Command was successful - remaining elements are the returned data
1Invalid parameter or command name
2Command failed
3No data available

In the case of an error return (not 0), the remaining elements in the list are the exact error message that explains the problem.


Sample Apps

Here are some sample apps that call Intentsiti:

NameFrameworkCode
Intentsiti DemoAI2IntentsitiDemo.aia
WiFi StatusAI2wifistatus.aia


Legal Notice

Legal Agreement

Privacy Policy

Permissions

Intentsiti requests the following Android Permissions:

- Phone
Read phone state - to get the phone ID for the "uuid" command, and the info for the "phone" commands.

- Wifi
Read WiFi state - to get WiFi information for the "wifi" commands.


Contact Us

Please send comments, suggestions, and bug reports to:

Facebook: http://www.facebook.com/pages/Closecrowdcom/249795408478730

Email: closecrowd@gmail.com

Twitter: @CloseCrowd


Copyright © 2014 by Mark Anacker - CloseCrowd.com. All Rights Reserved