Firing an activity on receipt of some file over bluetooth - android

Is it possible in android to start an activity on receiving a file over bluetooth? I do not have a bluetooth connection established inside the application. I wish to know if a user externally accepts a file, could my application register this event and start an activity. Maybe by checking for a specific file name in a known path.
I have looked into passing intents of various kinds to even start activities residing in other applications.
Thank you.

i think it can be done with BroadcastReceiver and BroadcastReceiver.PendingResult
But PendingResult is available only in honeycomb(int version 11).

Related

Check Internet Connectivity In Android App

I have made an app, in that I need to check if internet is available then it should work otherwise should give popup.
As I have made whole app I want to avoid writing the internet connectivity check function in each activity or calling it multiple times.
So I am wondering is there an easy way to check internet connectivity of app in whole app by writing it in either Manifest or other way?
Thanks in Advance
In Android, there is a pretty neat resource called Broadcast Receiver. What you need to do is to declare a new class that extends a BroadCast Receiver object and then register in your manifest file for the "specific filter" that you are looking for, and whenever the connectivity goes away, or the network status change the Android SDK will launch an Intent in your app.
Check this question. :
Broadcast receiver for checking internet connection in android app

How to startActivity from service that has android:singleUser and permission INTERACT_ACROSS_USERS

I'm looking to expand my app to handle Guest Mode, introduced in Android L. I found that if I create a service with android:singleUser in AndroidManifest, with permission INTERACT_ACROSS_USERS, and I'm a system app by installing it in /system/priv-app, then my service is running even as I switch user. But my app needs to interact with the user, by being able to launch an activity, show a toast or notification. All of those things seems to not be possible. Is there a particular flag I need to set when I call startActivity so that it will launch a new activity from my service?
I found a way to do it. Basically have a singleton Service, which is a service with the android:singleUser="true" and with INTERACT_ACROSS_USERS and have the APK installed in /system/priv-app. Then have it broadcastAsUser to all users. You'll need to use reflection to access methods in UserManager. Then have a receiver instance which will receive the broadcast in the guest user's space, and then have the receiver startActivity.
There are several internal apis (comments as #hide) like Context.startActivityAsUser, NotificationManager.notifyAsUser to support it, but it needs build from source also with platform signature.

Change intent filter android priority of other applications

I have a SMS Blocking Android App. It worked fine until Google introduced SMS feature in Hangouts and so did Samsung in its ChatOn messenger. Both of them have the highest priority for SMS receiver ie 2147483647. I verified this from their manifest.
So is there anyway to decrease their SMS receiver priority using what so ever method including root?
I plan to implement a "click to fix" option after a user opens the app.
The only way I could think of doing this was to edit the manifest file of these applications.But again I am not sure how android processes the Broadcast receiver. Does it use its own internal memory to know which app will process the sms received broadcast, or does it read the manifest file of all the installed applications every time?
If there is a separate memory how can I access it(using root, if required) and if manifest file is read every time, is it possible to edit that file even with root, as I read there are signature related issues.
P.S In root programming i have just experimented with calling standard sudo commands inside an app. Also my main focus is on pre Kit Kat devices.

Anybody knows about ACTION_RF_FIELD_ON_DETECTED?

I want to use this broadcast intent to start my activity as soon as my mobile enters NFC reader's field? Please help if anybody ever done this....
It is possible but not recommended to do this.
First off, the ACTION_RF_FIELD_ON_DETECTED is a protected intent. To be able to receive it you have to white-list your application in the etc/nfcee_access.xml file. This file grants access to the secure element, so it is not writable on non rooted phones.
Second: The ACTION_RF_FIELD_ON_DETECTED event is not reliable. This is stated in the source-code and true in praxis. You simply don't get such the intent every time the phone senses an RF field (has technical/historical reasons that I won't explain here in detail).
If you can work around these two problems, you can just list ACTION_RF_FIELD_ON_DETECTED in your manifest and Android will happily start your application.

Start Android application from NFC-tag with extra data

I can start my application by simply putting the phone on a NFC-tag. But I would like to take the idea one step further. Imagine a simple time-tracking application with two NFC-tags. The first will start (and download) the application and register a starttime. The other will also start (and download) the application, but register a stoptime.
My problem I'd like to solve is that I don't want my phone to know about these tags. The application should not need to have a list of tag-ids programmed and know what actions that is connected to each id. The tag should carry the information needed to start the action on the phone with the correct parameters.
Are there any information about how to accomplish this scenario? I have installed "nfc-eclipse-plugin" but doesn't understand how to use it to get my goal and even less how to get my application to read the extra data.
Thanks in advance
Roland
Your tags should be capable of storing NDEF messages. Such messages are automatically read out by Android and passed to your app in an Intent. Automatically installing and/or starting your app can be accomplished by putting an Android Application Record in your tag. Any additional information ("start" or "stop" indication) can be stored in a proprietary record.
You probably want to put the AAR as the last record of the NDEF message, as it is detected and acted upon by Android automatically, but is only supported since ICS. To make automatic installation work with Gingerbread, you can put an additional URI record or SmartPoster record with a Google Play Store link in it as the first record of the message. Your app should then filter (ACTION_NDEF_DISCOVERED) for this URI, so it will also start automatically on Gingerbread.

Categories

Resources