Control App Sony Smartwatch2 - android

Hello I am developing an app for the Sony Smartwatch 2 and I have a couple of questions:
First: is it possible to Launch the "app on the watch" using the app on my phone? I mean I want to be able to click a button on the phone which will automatically launch the app on the watch.
And my second question is: how do I send data from the phone to the watch, for example, I have a Serie of layouts and according to what the user clicks on the phone it will Show a different layout on my watch.
Thank you very much.

If you want to start the SmartWatch 2 you can do it using this code:
Intent i1 = new Intent("com.sonyericsson.extras.aef.control.START_REQUEST");
i1.putExtra("aea_package_name", "com.youpackage.name");
i1.setPackage("com.sonymobile.smartconnect.smartwatch2");
ctxt.sendBroadcast(i1, "com.sonyericsson.extras.liveware.aef.HOSTAPP_PERMISSION");
For the SmartWatch 2 all of the code runs on the phone not the watch, so if you want to share data between the phone and watch you can use regular android methods. If you need real time communication you can always use a broadcast reciever. Follow this link for instructions on how to setup a broadcast receiver and download the sample so you can get a better idea of how it works
https://developer.android.com/training/run-background-service/report-status.html

Related

How to Show Notifications when get close to Beacon even if the app is closed?

I have created a mini App that helps me playing with beacons.
-what i have done so far-
So until now, I have successfully connected my App to the beacon, made 2 texts, so when I'm in the app and get in the beacon's range, the texts are changing so I can see that, move 2m away or turning the beacon upside down so it simulates Out of range, and it will show the message that I'm not in the range anymore.
So far so good, I have also successfully made the app to show notifications when I get close to the beacon, and when I click the notification to open a second activity.
-the problem-
Now, I want to show a notification when I get in the beacon's range, and the app is closed (not in the background). And after, when I click on that Notification to open my app / open App Google Play's Page if not installed.
I have searched on the internet but I haven't found anything conclusive.
If you guys know anything, or have you accomplished this task, it would be great if you can help with it.
If you need more info like, my activities code I can upload it, but I considered unimportant.
Thanks!
Two points:
In order to make a phone react to a beacon without your app installed (e.g. to launch a PlayStore page) you need an app prei-nstalled on all phones that does this for you. The Google Play Services app used to do this through the Nearby feature, but it was discontinued in Nov. 2018 because of spam concerns. Since then this is no longer possible to do.
If you do have your app installed it is a straightforward process to detect in the background and send notifications. The Android Beacon Library provides instructions here:. https://altbeacon.github.io/android-beacon-library/notifications.html
You could create a BoradcastReceiver that intercept the android.intent.action.BOOT_COMPLETED.
In that way, you can launch a part of your app when you turn on the device.
There, you can use a Service or something that can manage the interactions with Beacons.
(BTW, i never worked with Beacons, i don't know what are the policies that you must follow).
If you don't need to launch the app when the device is turned on, anyway you can use a simple Service
Here the link to the documentation of receivers documentation.

Android - how can I create a service that listens to speech?

Does Android allow to run a Siri type app that runs in the background (with a service, every time the user turns on his phone, without the user opening the app) and listens to the users and then performs actions based on their speech?
Here we have a library called gast-lib that check device sensors and something that you wanna do is here SpeechActivationService
check it out, hope it help ;)

Can we automate "Call Receiving" feature in android?

I'm trying to automate calling features in android using robot framework + appiumLibrary.
What I've done so far?
I am able to dial a number using these steps :
Step 1.
Open Application http://localhost:4723/wd/hub platformName=Android platformVersion=5.0.1 deviceName=4a119f6b appPackage=com.android.contacts appActivity=com.android.contacts.DialtactsContactsEntryActivity
Step 2. AppiumLibrary.Click Element name=Keypad
After this I clicked on each number one by one and then clicked on dial button.
Where am I stuck?
In similar fashion I am trying to automate Call receiving feature. I'm dialing from some other phone on connected device and while phone is ringing I'm trying to capture screenshot of xml using uiautomatorviewer.
It is not capturing it.
Is it the right approach?? Is there any other way to automate this functionality?
This depends on your screen mode when you receive it:
If the screen is asleep, i.e., when a call is received it opens the activity to deal with the call, then you can detect what is the package on the screen and match it with the package of the call activity.
If the screen is awake, i.e., when a call is received you see like a small pop up on the top of the screen with the "Answer/Reject" options, then UiAutomatorViewer can't detect them. I don't know if Appium can detect it or not, but I suppose it can't (UiAutomator can't for instance, it can only detect what UiAutomatorViewer detects).
In summary, if a new app is opened, you can detect it is the call app. Otherwise, the "popup" isn't detectable.

Monitor any other running app from a service Android

I was developing an app for an enterprise which has given the employees an android phone, they wanna monitor every time a user tries to open any other app and send a report to a manager so I´ve developed an android service that checks every time any other app is call meaning: OnCreate, onResume, etc.(that´s done) Now they wanna check what that particular user did once he got into the other app: for example if he opened the messages(com.android.mms) , what message he sent or what he had recieve. other example: if he opened the dialer(com.android.dialer) they wanna know what phone he called. What makes it tricky for me, is that they want this for EVERY POSSIBLE APP a user can have installed in their phone.
My Question is the following: is there a way to capture this kind of information of a running app, from a service?
I appreciate any answer and I´m open to suggestions of how should i do this.

Android Wear: creating shortcut icon on watch from app on phone, which fires an intent on the phone

Sorry if this sounds like a lazy question, but I've Googled and couldn't find an answer: I suspect this is because it can't be done as I describe below.
I have an app which runs on the phone for remote controlling power devices. At the moment, users can create a home screen icon on the phone, which fires an intent on the phone which launches my app in the background to execute various macros.
I want to extend this functionality to Android Wear devices, i.e.
1) on the phone, the user would press a button which would programmatically create an icon on the Android Wear device (e.g. in Wear Mini Launcher), which would have an intent associated with it.
2) when the icon was pressed on the Wear device, it would fire the intent on the phone to launch the main app on the phone in the background which would then execute on the phone.
Is this even possible? I would like to avoid having to write a specific app for the Wear device if possible.
Any suggestions welcome, or code snippets would be even better! Thanks.
Andrew
You can do some of what you want, I'll break it down into your separate questions.
1) You would create a mobile and wear app, when the mobile app is installed it will install the wear app as well. There's no way to install them otherwise.
2) On the mobile app you could create a wearable listener service that would respond to messages from the wear app. On the wear app when you do your initial launch of your activity you could send a message to the listener service via the wear messaging api and the finish. Within the mobile wearable listener service upon receiving the message you would launch your intent.
Here's a pretty good example of how to do this -
Wear Messaging API example

Categories

Resources