Router API: Remote intenting
|
Introduction | Remote intenting | Group communication | Device connection | Java API | Tutorials | Architecture | Contact |
PeerDeviceNet provides similar API to send remote intents. Apps
should add this permission in its AndroidManifest.xml:
<uses-permission
android:name="com.xconns.peerdevicenet.permission.REMOTE_INTENT"
/>
Please note that
when sending remote intents, we can not send intents which
directly access device features such as camera, GPS etc. for
security reason, because they require system permissions which
PeerDeviceNet may not have. For these intents, we should create
customized intents and send to receiving apps at peer devices. At
receiving devices, an app with right permissions will register for
this customized intent and start activity using the right system
intents. Please check out RemoteIntentDemo
app and see how ACTION_DIAL and ACTION_CALL are handled.
Remote intenting are supported via the following three kinds of APIs.
Pack the remote intent to sent as an extended data item with name "REMOTE_INTENT":
Optionally add app package name; So at destination device, if no existing app can handle the sent remote intent, PeerDeviceNet will prompt installation of named app from app store:
All the action names and data item key names are defined in Router.java.
When sending remote intents with startService(), the destination device info items must be set.
When sending remote intents with startActivity(), PeerDeviceNet will send it directly if the destination device is set inside carrier intent and already connected; otherwise it will bring up PeerDeviceNet GUI showing the list of connected devices to allow user choose which destination devices to send, or start PeerDeviceNet connection manager to search and connect to peer devices.Please check out the source code of RemoteIntentDemo app, which shows how to use startActivity() to send remote intents. The complete source code project can be downloaded here and app can be tried out directly from Google play.
More details and sample code is coming.