How can I know the intents needed to open system activities - java

I have the need to open android's default screen settings, and previously I wanted to open android's default alarm configuration activity, in the future I'm thinking I would want to open GPS settings.
How can I get the information needed to start this activities?
Where can I found the documentation about this?
What's the process for getting this information without googling for the specific activity?

Check the Common Intents listing in the documentation.
It's a pretty comprehensive listing of the actions, URI formats and MIME types for building Intents for the standard Android applications.

There is a list of Actions in the documentation listed here.
You can launch any of the sub activities in the settings app using something like:
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

Related

Launch any maps app on Android

I want to create an Intent in my Android app that launches a map application with a specified address in response to the user clicking on the button. It is straightforward enough to do this with Google Maps, as is explained here.
However, I was wondering what the correct way to do this would be in order to launch any maps application (i.e., not necessarily Google Maps). This way, if the user prefers a different maps application, it would open in their app of choice instead.
For example, to launch the user's preferred calendar application, one sends an Intent to com.android.calendar, and it opens whichever calendar application is the default, not necessarily Google Calendar.
Use a geo: URI, as stated here. Disappointingly, this does not provide a mechanism for launching directly into turn-by-turn navigation.

Open Another App with android.intent.action.VIEW

I want to open another app and open a specific page in it!
in their guide they said to use the bellow for default action
android.intent.action.VIEW
and use a kind of intent, which didn't get which, like bellow to go to that specific page:
somecompany://details?id=com.example.calendar
but i don't know how!
And i tryed a ton of solutions but coudn't do it !
Thanks for your help.
I think this is what you're asking for. This will open a specific app's page in the Google Play store.
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(
"market://details?id=com.mycompany.mypackage")));
Don't replace the word market. That is specifically reserved by Android to open the Google Play store.
You can launch an app using intents. But to go to a specific page in the app, there should be a pre defined intent to reach there. Either it can be custom intent defined by that app and exposed to others or may be predefined system app. For example, you can open Settings application and reach a particular page in it based on the intents "Setting Application" has defined. Another example is "Camera Application". You can launch it and reach some page in it but not all pages.
In your case you may try something like this though:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "video/mp4");
I hope you understand what I meant.

First android app for iOS developer

i am iOS app developer. Now when i created an app on iOS i want to do the same on android. With java i was familiar just now need some time to remember.
i was looking at some tutorial how to do one or other things. But what i can't find is the basics how everything works. How classes is interacting with each other.
For example i want to create registration window with few buttons and alerts.
I want registration window to be called just once when app is installed and just that.
Should i create new java class and few layouts, one for View with buttons and other for Alerts ?
Or should i create other class for alerts if i need them in other flow of my app ?
And how i should call that window with registration from my main class, which is
extends Activity
Also if there are some developers who came this road from objective-c (iOS) to java (android). It would be nice for some share experience how they did that.
Thank you for any help :)
Very few of the concepts in iOS and Android are similar. On Android you have Activites, Intendts the Manifest. When you design your layout it should be resolution independent. You have a search, back and a menu button and variable hardware. All of this has no equivalent in iOS.
That said, I think you just have to read the basic concepts and the getting started guide no matter if you come from iOS or never have done mobile development before.
EDIT
To answer your concrete question. Take a look at the lifecycle of an Activity and Preferences. With this, you could do some action on the first start of your main Activity and store some flag in the preferences when it's done. On the next start you just test that preference and skip the logic.
You can create one activity (.java file) and one layout(.xml file with buttons and input boxes) , alerts could be toast notifications:
http://developer.android.com/guide/topics/ui/notifiers/toasts.html
All you require for this is a activity and a layout xml for that activity, this activity will be your main ie the entry point to your application, in that activity oncreate method you can check if it is registered or not by setting a flag or something which will direct to the next activity if its registered.
GOOD LUCK...
Just like your nibs in iPhone you create xml layouts in Android. And for view controllers here you make activity. One important thing is AndroidManifest.xml file, it contains all information of your app (like plist) plus all the activity information(Intent type and launcher methods).

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.

Where to put the Settings in Android?

On the iPhone/iPod touch, settings could be kept in the Settings.app. Can you do this in Android? Or must your settings be in the actual application?
Can you do this in Android?
Only if you are making your own firmware. Ordinary SDK applications do not have the ability to add to the roster of device-wide settings.
Or must you settings have to be in the
actual appilcation?
Yes. You can have the same look and feel as the main Settings application, by use of PreferenceActivity and preference XML files.
Android UI guidelines state that it is preferable and recommended to use a PreferenceActivity to handle all of your apps settings.
The beauty of using a PreferenceActivity is that it will automatically save the values to your apps SharedPreferences.
Another point to consider is if all the other apps are using PAs then they come to yours and have to handle the settings differently then it makes their experience more difficult and could cause them to look elsewhere for another app.
Hope that helps, good luck with it

Categories