Calling APP Functions outside of app? - java

I'm a beginner Android developer so sorry if this sounds stupid but I'm trying to figure out how to call a function of my app or to call the app outside of app itself. What I mean is, say that you're playing a game, talking to friends or watching a movie. I was wondering what approach I would use in order to solve my problem?
Also, I was wondering how I can get my app to appear in the notifications panel persistently (such as that it's online kind of like BBM).
Any help wold be greatly appreciated,
Thank you in advance.

You can create a service in your app and declare it in the manifest so that other apps with a specific intent-filter can call and initiate your service. It is also possible to have the service running in the forefront (like how Facebook messenger works)
I don't know about persistent notifications, but you should check out Push Notifications in general. You can easily create one within the app. Possibly monitor if it is dismissed and re-initiate it?

Related

How to let your app take data from apps that are already installed by Android

I want to make an app that takes info/data from other apps that are already installed on my phone ( Android ). By example: Let's say I want to make an app that shows how many messages I sent to each person with my phone. Then I would like to get my app linked with the message app on my phone and count how many times I sent someone a message , get that data, and put it on my app.
When I search for this problem, one 'solution' I found was working with intents, but it's NOT that, by far as I know, you can use intents to share data between apps you created yourself. I want to be able to get data from apps that I did not make. HOW? Thanks already
You can't, otherwise it would be a security issue, think about a bank app... In Android all the apps are fisically separated into different directories.
You can access data only from apps that expose methods, like Intent.

Android development: Access to the activities of other apps

Is it allowed in Android that developers can access the activities of other apps? For example, can my app get triggered when some other app is put from foreground to background or the other way around?
I checked some websites, they mostly talked about how to manage the activity of your own app....I've read someone's article saying there was an API allowing developers to monitor other apps but it was banned after Android5.0.
So please help! I really have no idea if it is possible...Thank you!
Not without access to the framework can you do this. Android was meant to have isolated processes so that this can be avoided. The only thing you can do is launch someone's else's activities should they follow certain criteria. But once it is launched, its under the process of the app you launched, not yours. You should NEVER be able to take control of someone else's process unless they allow you to via some hooks.
One hacky and error-prone ways is to monitor logs and check which activities are launching.. but this is horribly inefficient.
Have a look at my answer here # https://stackoverflow.com/a/35594313/529691

Ideas for my app that runs in the background

I'm developing an app that runs in the background that essentially snaps a front facing photo every time the phone is successfully/unsuccessfully unlocked. This isn't an original idea, but I'm developing it as a final project for my college android programming course, with no intent to sell this app. I have a general idea how I am going to go about this via some research but I keep running across a problem.
I know that it is hard and bad practice to run an app continuously in the background, so the idea is you put the app to sleep and set an alarm. My problem is that if the would be phone-snooper were to get really lucky, they could access the phone in between the alarms, and the owner of the phone would never know. I talked with my professor, and he proposed a couple ideas, but we could not come up with a definite solution, so I'm asking opinions here. Any idea how to subvert this dilemma? Thanks a ton.
Your approach is probably not appropriate for the problem. You can't "time" unpredictable events (like someone attempting to unlock a phone). Or else it's not clear how you are setting the alarm.
You should change the approach to an event-based approach.
Either provide a service for a lock-screen app so that it can use your code to capture a pic by sending login attempt events to it. You write that and provide an SDK/API.
Or else create your own lock screen app with your feature:
https://stackoverflow.com/questions/10864300/create-a-lock-screen-of-my-own

Android Test Platform Generator using java

So I have received a task to develop a prototype software for testing the software/hardware component of android. Example: By using the software I can send a command from my PC to my android to change the color of screen display without interacting with the devices(touch,shake or other possible gestures). I would like to know how do I actually start. The whole idea is actually messed up in my mind. Because after a few days of research I haven't found any topic related to what I am going to do. I am still fresh with java so please go easy on me :) Any help is much appreciated.
hi this is very much feasible. First you need is a web service that connects your software to your phone. When you give command on your software, the command should go trigger the web service which in turn should send a push notification to the phone to execute your command. You will be needed to create a some sort of listener and push notification system on your phone(Hint GCM may work). Also you will need to add permissions to your app that is listening to the notifications. Does that make any sense to you?

Android: Possible to start any activity of other apps from my own?

This is an Android noob question.
I am trying to start an activity of another apk through my own application. Now I know I can launch any other application and invoke its main activity. In many cases I'm also able to start subactivities, for example display it's settings dialogue.
However with some applications, for example Facebook or Endomondo I would get a FC everytime I try to launch some specific activity of their application.
Now I suspect that this is a permission issue and that the Facebook or Endomondo devs just don't want other applications to get access to their activities. But do I have to find out which activities I can use and which ones I can't use by trial and error every single time?
Plus: Is there any way around this dilemma? Maybe on a rooted device?
Cheers for any pointers.
As you already said you can only use activities of other apps which are designed to be used by others applications. Normally the developer of the other app define a set of intents and actions their app will be able to understand and process.
Using any other app's activity is by default not possible, this is by design of Android as every app runs in it own sandboxed process (there are some exceptions where apps can share a process).
So to use another app's activities you must know the intents it listen on. Normally this can be found in the applications website or documentation or on OpenIntents a dictionary for intents.

Categories