ActivityRecognition on Android Wear - wear-os

I am developing Android Wear app that uses activity recognition to see if a user(office worker) have been in a still position for a certain time (if the user have been on their desk for too long), if so, it pushes notification, telling user to take a short break, and take a walk . I have followed a couple of ActivityRecognition tutorials aimed for handheld devices. After implementing code, during initial test the app on my watch does seem to recognise activities that I am undertaking with some minor issues. However, on stackoverflow I read that since android wear does not have dedicated ActivityDetection API, it will misbehave. Someone instead suggested to use accelerometer data for motion detection. On the other hand there is Google Fit API. Since I am new to android wear development I am not sure what is the right way to go. Could you please give me an advise on what is the right way to go in terms of tracking user motion, and if using ActivityRecognition for wear is reliable? Or should I try to make use of Google Fit API?

Google Fit API is commonly use to let users control their fitness data. If you want to push notification once a user is still in the same position for a certain time, I think you can use this API whenever a specific data source or data type is updated on the fitness store. Check on this documentation.
However, I have found this related SO question regarding Android activity recognition on wearables. I guess you already checked this link and I agreed on using accelerometer data to monitor the motion of a device.
The following code shows you how to get an instance of the default acceleration sensor:
private SensorManager mSensorManager;
private Sensor mSensor;
...
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
Hope this helps!

Related

Conversion of my Project from Youtube data api to dailymotion api.

I have a complete source code of a project using you tube data API v3, when i try to publish my app its continuously rejected due to copyright issue. (i m using someone else channel link),
here is what it says :-
I reviewed your app, and had to reject it because it violates our device and network abuse policy. If you submitted an update, the previous version of your app is still live on Google Play.
Here’s how you can submit your app for another review:
Your app shouldn’t access or use a service or API in a manner that violates its terms of service. For example, make sure your app doesn’t download, monetize, or access YouTube videos in a way that violates the YouTube Terms of Service.
Read through the Device and Network Abuse policy for more details and examples.
now i want to change my code from You tube data API to daily motion API, and i need your help.
Or if someone has any solution how can i get my app approved using someone Else's channel. ?

Is it possible to achieve my goal by using Beacons

I have a mobile IOS application which is basically group chat oriented. I was wondering if I can make it beacon-enabled app. With other words, application which can detect beacons, determine id, receive short ads etc. I am quite new to beacons, still reading a lot about it. I found this article which makes me believe that maybe it is possible to achieve my goal.
I want my app, except for its original functionality, to be able to:
Detect a beacon (even if app is in background, without the need to have been paired or whatever)
Receive simple ads by the beacon (while using the app in a certain mode, to be able to project the ads on phone's screen)
Read some real-time info(if required by the user) like: speed(if moving beacon), temperature etc.
In order to achieve all that I would like not to disturb the end user by making him download additional stuff related to the beacon. I want him to have my app and that's all.
You can monitor for beacons while your app is in the background. You can do this by using the CoreLocation Framework or by using a framework of your beacon supplier. (e.g. Estimote)
To the ads: The beacon will only deliver its pre configured ids. (UUID + Major + Minor). If you want to receive ads, you must have a Webservice that will get your beacon ids and return you the ad to display.
(If the ads never change, you can put them directly into your app without a webservice)
How you will show the ads in your app is completely open to you.
I don't really understand what you mean with real-time-info. There are beacons that also send you TLM. So you can get the temperature and the battery level of the beacon. I've never seen moving beacons or beacons that can transmit their speed.
Some useful links:
https://developer.apple.com/ibeacon/
https://xamoom.com/en/2016/07/ibeacon-for-developers/

(Eddystone) Is it possible to get the number of times an URL is received by a device without writing your own app?

Is it possible to get the amount of times an URL is received by a device from the proximity beacon API? I want to know what the click through ratio is of the broadcasted URL.
That depends. If you write your own app that scans for Eddystone-URL beacons and triggers some content (e.g., the web page itself) off of that, then naturally you're in full control and can implement this kind of analytics. Though it'll only apply to people which installed the app.
If you rely on Chrome for iOS, or the Physical Web iOS and Android apps to discover the Eddystone-URL beacons, then these apps do not provide any such numbers.
However, both Chrome for iOS and the Physical Web apps do fetch some metadata about the URL they detect, such as the page title and page description, without the user first clicking on the link. So there's a slim possibility that you could filter such requests out (they will be made by the Physical Web Service, or some similar "bot"), separate them from the actual visits, and do analytics based on that. Most likely however, this "bot," or the proxying service (which is there precisely to prevent this kind of tracking, and protect the user's privacy), will also do some caching, so you'll see fewer requests than the actual number of times the URL is received by the device.
And finally, dropping to a lower level, a note: most beacons are uni-directional, i.e., they broadcast information, but don't receive any information back, so beacons themselves usually can't count the number of packets on the receiving end. (I guess you could technically use the Bluetooth "scan response" mechanism to do that, but it would require custom beacon hardware/firmware.)
Unfortunately, no, it will not do this by itself.
Google's Proximity Beacon Api is a server-side system that stores metadata about beacons (location, battery level, etc) It requires you to add special client code integrated with your app to submit detection data.
Similarly, detecting Eddystone-URL beacons generally requires you to add custom code to your app to do the detections and and present the URL to the user. (The only exception to this is for some Chrome for iOS users with the Chrome Today widget enabled, and no public system provides click through rates.)
Since your app must present the URL itself you really have to roll your own solution to this problem.
If I understand right, you should be able to achieve this by Google analytics campaign. Setup a campaign, add campaign url to ibeacon url and you should be able to check the details analytics through Google analytics.

Android Default SMS App permissions kitkat

After going through lots of codes provided over the internet, I am still unable to list my SMS app in default Android kitkat version. I don't know whether it can be done by adding permissions to the manifest file or through .java code.
The only thing I want is to, provide me some to-the-point code which I can make a new blank project(ABC), set the code in and that should set my app (ABC) the default sms app.
You can't directly set your app to be default, that would be a nasty security risk. What you can do is to signal to the user that you want your status to be changed and the user will decide:
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, activity.getPackageName());
activity.startActivity(intent);
However, to be eligible for becoming a default SMS app, you have to implement all of the functionality required from such an app, and this includes the handling of all SMS/MMS related functionality (sending and receiving, notifications, etc). This practically means that you have to rewrite the complete related functionality of the phone, including all receivers, intents, filters and code (and you should be aware that SMS and especially MMS handling is not part of the system, it requires quite a lot of your own code). And this is also the reason why you won't be able to receive an answer that fits into the confines of a SO answer. Way too much code: basically, a complete app.
There is no way out: if you want the user to replace the default SMS app, the user will rightfully expect that whatever app they choose will continue to support all of the functionality. Unless you provide all that, your app will not be listed among the eligible ones and the intent above will not work.
The Android Developers blog of Google has an article titled Getting Your SMS Apps Ready for KitKat that gives you the very first steps in learning what's expected from you in this scenario.

Changing Kontakt.io beacon characteristics using their Android SDK

I've been trying to use Kontakt.io's sample Android app(available at this address) to implement a simple app that would connect to a Kontakt beacon and change the details such as major, minor, txPower etc. I'm able to detect the beacons and read the correct details for all the above but I am unable to change them. Looking at the sample app, the steps should be straightforward and this is what I've done
onBeaconsDiscovered has a list of BeaconDevice objects as a parameter so I choose one of those BeaconDevice objects and store it in variable called beacon.
I then say beacon.setPassword("password".getBytes()). The actual password used is the password for that specific beacon from the Kontakt.io web panel.
BeaconConnection beaconConnection = BeaconConnection.newInstance
(MyActivity.this, beacon, connListener);
beaconConnection.connect()
That should be it according to the sample app, but it doesn't seem to actually work. I connect to the beacon(meaning onConnected() callback is called) but I then get an error saying authentication has failed due to a wrong password.
I've tried this with a couple of different beacons, new from Kontakt, using the password from the web panel and it doesn't work so, while a possibility, I don't think I just have a faulty beacon.
There are some comments in their docs about a master password for these beacons - not sure where to get that or if that is what is required.
I'm slightly suspicious of the fact that Kontakt has this sample app here but they haven't released it on the Google Play store(i.e. does their code actually work?).
Either way, I'd appreciate any thoughts on what I'm missing.
I am trying to use this as part of a large application that would do a bunch of things with the beacons, hence the need to write my own app.
Please note this is specifically regarding Kontakt.io beacons and specifically their Android SDK.
beacon.setPassword("password".getBytes())
Kontakt.io's beacons have 4 byte long password which is why you can't get access to your beacon parameters.
The sample app allows you to authorize your beacon and manipulate its parameters.
Please note also that once you attempt to authorize the beacon with the wrong password it will reject the connection and change its state to NON-CONNECTABLE.
The NON-CONNECTABLE state was introduced to prevent multiple connection requests from unknown users.
The NON-CONNECTABLE state lasts no more than 20 minutes and during this period no connection can be established to your beacon.
For more information, please visit kontakt.io's knowledge base or kontakt.io - Beacon datasheet

Resources