How intercept a google maps intent in Android?
How intercept a google maps intent in Android?
I was trying to intercept a google maps intent as the following:
Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:37.423156,-122.084917"));
but I haven't found any example, link or documentation of this. So, I'm thinking that unfortunately is not possible.
In the Manifest file I put several intent filters. Specially I think that the next intent filter must match with the mentioned intent.
In addition I tried to investigate what activities match with this particular intent by means of:
List resolves = getPackageManager().queryIntentActivities(myIntent, 0 ); ResolveInfo firstRevolve=(ResolveInfo) resolves.get(0); IntentFilter myIF=firstRevolve.filter;
Nevertheless only MapsActivity matches with the intent, not my Activity, and surprisingly myIF is null, so that I can't obtain the intent filter that the google maps activity uses.
In addition I installed "Intent Intercept" from Android Market, but it does not capture this intent.
So, I need some help/idea. Somebody knows what is happening? In my opinion Google restricts this interceptions but this restriction is not specified.
Any help will be appreciated. Best regards, Pablo.
Answer by CommonsWare for How intercept a google maps intent in Android?
So, I'm thinking that unfortunately is not possible.
I am rather sure that it is.
Specially I think that the next intent filter must match with the mentioned intent.
You have the wrong action string. If you read the documentation, the string representation of ACTION_VIEW
is:
android.intent.action.VIEW
which is not what you have in your
.
Answer by Nick Peters for How intercept a google maps intent in Android?
The code example below is just working fine in my project.
Answer by ramk for How intercept a google maps intent in Android?
I have been trying to get this to work as well. there seems to be couple of way here:
1) Intents with scheme: "http" or "https" with authority "maps.google.com". This seems to function normally as standard intents do. 2) using the "geo" scheme as OP mentioned in the question. Seems like this is not open to be intercepted.
@CommonsWare Even if one uses "android.intent.action.VIEW" in the manifest with the following filter: ,
it seems NOT possible to intercept it.
When you mentioned "I am rather sure that it is.", did you mean it IS possible or it IS NOT possible?
Answer by Radon8472 for How intercept a google maps intent in Android?
This manifest entry worked for me:
in your activity you can check onCreate:
protected void onCreate(Bundle savedInstanceState) { Intent intent = getIntent(); String action = intent.getAction(); Uri data = intent.getData(); if( Intent.ACTION_VIEW.equals(action) ) { if(data != null && "geo".equals(data.getScheme())) { // do something with geo uri data } } else { // Code for activity when it`s started without geo uri } }
Answer by Mina Fawzy for How intercept a google maps intent in Android?
I use multi intent filter and this work with me
Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72
0 comments:
Post a Comment