Android Google plus how to NOT share my location - android

Here is the thing, when you are sharing using android Google plus this what it does:
For your first attempt to share anything, you will get 5 steps process when you be asked to think all what you got(including your sole) with Google plus app.
Then you will be finally redirected to the share activity, witch at first starting by 5 sec of loading in order to attach your current location to the post.
Lets ignore for a sec about the first(unforgettable) time. But for all the rest of times when I wish to share some thing from my app, how can I do this WITHOUT attaching my users location?

You can't. When you broadcast an Intent to share something (like text) and the user selects an app to complete the action, it's completely out of your control. There are (thankfully) no flags you can set to disallow things like attaching location on the other end of the Intent.
Think about the implications of allowing the sender of an intent to dictate how the reciever handles it. You can't predict how the user will want to share something. If they don't want to share location, they'll remove it. If they do want to share location, you shouldn't be able to block them. If they don't like how slow Google Plus is, they won't use it.
This isn't your problem and trying to make it yours will only frustrate users.

Related

Can an activity be invoked when the app is not opened from some pending intent without using notification or button clicks?

Note: I haven't coded anything but looking for a structure/keywords or ideas how it can be achieved.
Use Case:
I have an activity which basically shows some display/data/or does some operation etc when opened manually from button click, notification click etc. Now I want to display the same stuff when a particular condition is satisfied [like my geo location matches that I force to be my home or user home].
1. without user clicking any notification,
2. without opening the activity,
3. without clicking buttons, and
4. without opening the app.
So in short, I want my app to be launched when I am home or reach a geo fence, is it achievable?
I am aware of Pending Intents, but seems they need the activity to be opened once and register the intent, let me know if this is the only way to go.
Kindly help!
when a particular condition is satisfied
This is not possible in general. For example, Android has nothing built-in with the ability to do something automatically based upon when your neighbor's cousin's daughter posts something on Stack Overflow. Even though that is a particular condition that could be satisfied, Android does not know your neighbor, nor your neighbor's relatives, nor the neighbor's cousin's children, nor the online actions of your neighbor's cousin's daughter.
There are specific things that Android can handle that offer the ability to give you control for related conditions, such as AlarmManager for getting control at certain points in time, or JobScheduler for getting control periodically when the environment is proper (e.g., we have connectivity and are on a charger).
Your question uses a geofence as an example. The Play Services SDK offers geofence APIs that you can use, that can give you control when the user enters a particular region.
I want my app to be launched when I am home or reach a geo fence, is it achievable?
You are welcome to call those geofence APIs, providing a PendingIntent that points to a WakefulBroadcastReceiver, which in turn points to an IntentService, where you can go do something.
If by "my app is launched", you mean bring up one of your activities, while that is technically possible using an activity PendingIntent, you may make your users very unhappy for interrupting what they are doing (e.g., collecting Pokémon). Please consider using a Notification instead.
I am aware of Pending Intents, but seems they need the activity to be opened once and register the intent
Nothing of your app will ever run until the user manually runs your app (e.g., taps on your home screen launcher icon) or until something else uses an explicit Intent to start one of your components. At that point, you can call the geofence APIs, assuming that you somehow know where the user's home is.
Most likely, you need the user to spend time in the activity simply to collect the data from the user about where they want the geofences to be established.

Android global mutex?

I have a series of Android apps, and I need to coordinate their execution. On any given device, there can be any one of those apps installed, or any two of them installed, or any three of them, or any four, and so on. All of those apps can do one specific thing, and they all will try to do that thing from time to time. Now here's the problem: at any instant, at most one of those apps should be allowed to do that thing. If any one app is doing that thing, none of the other apps should be doing it; they should either wait for their turn, or simply pass. In other words, I need a global mutex or critical section mechanism on Android. In addition, I want to avoid NDK, if possible. What should I do?
You might have to give a bit more detail to get a more specific answer. But from what I understand it sounds like you could use BroadcastReceiver in each application that listens for an action to get broadcast and takes it as sign that it needs to either wait, or cancel it's action. Then inside each application whenever you are going to start your action you broadcast an intent with the action string something like `com.your.packagename.ACTION_STARTING_THE_THING. All of the other apps that are installed (if any) will receive this intent and can act upon it accordingly.

Design of website pushing info to the app, or app retrieving from website

I have a design question about Android app and I am not sure if I can ask it here (If not please advise when I can ask).
I want to make an app where it gets information from a website (or actually make the website push locations to the app). Imagine a webform that has 3 fields (3 trucks locations). I want that everytime I put those values and click submit, The android app on the devices will show the location of the trucks on the map. I am familiar with the google maps so I know how to show 3 dots on the map given the location. I also know how to write HTML code that would do POST/GET upon press of a submit button But the communication and how to initiate this trigger on the app is what I am confused about. So it is more of an architecture design question. I need a starting point to know where to start looking. I hope I delivered my point here.
sooo Any help ?:)
Your talking about setting up push notifications, look at http://parse.com/products/push
This may be a use case for using Google Cloud Messaging (GCM). I have not worked with GCM yet but this is one option.
Another idea is to setup an AlarmManager to schedule the fetching for data. One draw back I can think of is if you set the AlarmManager to be frequent (ex: every 10 minutes) then all those network requests are going to drain the battery quickly.
Another alternative and similar to the polling, is to have a button within the application where the user manually presses to get the latest data.

tracking user interaction Android

I am new in Android and is developing an app which runs in background as service to collect user activity. till now my app is able to get information about Time_Start, Time_End and Name of other app used by user.
I want to improve my app to be able to count how many interactions(like user tap, touch,...) user make while using other app.
any help?
Thanks!
AFAIK one can't catch touch events/key presses if they are outside your Activity's context or Application's context. I think it goes against the design principle in general ( every app. is sandboxed in its own DVM).
Also, Android has provided mechanism of Intents to track some specific actions and not evry interaction the user has with the mobile . So, I don't think it seems possible .

Using PassiveProvider and PendingIntents to ensure app location "freshness"

I was reading Reto Meier's (very useful) Android developer blog post A Deep Dive into Location when I read the following sentence concerning use use of the PassiveProvider and PendingIntents to help maintain a "fresh" application:
"If your app recognizes the concept of “exiting” (typically when the user clicks the back button on your home screen), it’s good form to turn off passive location updates - including disabling your passive manifest Receiver."
While I understand the need for apps to be "good citizens" in the Android community, doesn't this also defeat the purpose of using the PassiveProvider and PendingIntents to help ensure location freshness? From what I understand, turning off the passive location updates will prevent my app from receiving those updates. If this is the case, then when the user re-launches my app, wont they have to wait for another location fix? I know that I can call getLastLocation(), but I was just wondering how the PassiveProvider and PendingIntents help to ensure freshness when you explicitly turn them off when the app exits.
Well, I guess the answer is not so obvious :
there is no real way to close an application in android (for the user I mean). But the blog seems to assume that hitting the back button while in the main app screen/activity actually means to exit the app. This is, for instance, the way dolphin reacts to a back button hit.
So if people use this button, you can assume they want to quit your app and you can just close every resource you used, including passive location providers & receivers.
But, mostly, people will just hit the menu button and switch from an app to the other this way and let them all open. In this case, let your receivers in place so that your app keeps fresh as explained by Reto in his post.
Update : it looks like an official good practice to use back button this way (close app), this blog is quite interesting about it : http://www.androiduipatterns.com/2011/03/back-button-behavior.html.
Regards,
Stéphane

Categories

Resources