[android-developers] Getting Resource.NotFoundException
Hi everyone, my current problem is that I have two application. The first one defines a new permission and is already installed. The second uses the permission defined by app 1. When I try to install it by downloading it with the browser the PackageInstaller crashes. Looking at the logs it says that there occures a Resource.NotFoundException for the resource #0x7f04000a which is the label for the permission defined in app 1. Further on I found this line in the logs: getEntry failing because entryIndex 10 is beyond type entryCount 2 that tells me that there are only 2 resource entries. This is right for app 2 I want to install. app 1 has 11 resource entries. So I think the PackageInstaller tries to load the 10th resource from app 2 and not from app 1 where the resource can be found. What am I doing wrong? Lutz smime.p7s Description: S/MIME cryptographic signature
[android-developers] get Certificates from Package
Hi, I'm looking for a way to get the certificates from a package that are used to sign it. Using the PackageInfo class it is possible to get the signatures. But what can I do with signatures if I don't get the public keys to verify these. The next question I have where does the PackageInstaller verify the signed APK file? The PackageParser class loads the APK file into a JarFile object but does this automatically verify the signature? Thanks for help Lutz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: get Certificates from Package
Well there is a PackageParser class inside the core which reads the Certificates. But there seems to be no interface to get them via the standard API. Do I have to let my app parse the package it self? Am 23.03.2009 um 18:09 schrieb Lutz Schönemann: Hi, I'm looking for a way to get the certificates from a package that are used to sign it. Using the PackageInfo class it is possible to get the signatures. But what can I do with signatures if I don't get the public keys to verify these. The next question I have where does the PackageInstaller verify the signed APK file? The PackageParser class loads the APK file into a JarFile object but does this automatically verify the signature? Thanks for help Lutz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Question about OpenGL literature
If you're looking just for a book on OpenGL there are the official books: - The Redbook: The OpenGL Reference Manual http://www.opengl.org/documentation/blue_book/ - The Bluebook: The OpenGL Programming Guide http://www.opengl.org/documentation/red_book/ You can also look on this site: http://nehe.gamedev.net/ there is a OpenGL Tutorial but it is based on C/C++ programming language Lutz Am 25.03.2009 um 12:43 schrieb EvgenyV: Hi all, Can you please suggest some book(s) or any other useful references about OpenGL? Thanks in advance, Evgeny --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Http GET method with extra headers
Hi, try the 'setHeader(String name, String value)' method from the HttpGet class. For example: --- snip --- DefaultHttpClient client = new DefaultHttpClient(); HttpGet method = new HttpGet(url); HttpResponse response = null; method.setHeader("user-agent", getText(R.string.app_name).toString()); try { response = client.execute(method); } catch(IOException e) { e.printStackTrace(); } --- snip --- Using setHeader replaces the first header with the same name or if not found it will be added. Lutz Am 26.03.2009 um 13:23 schrieb zeeshan: Hi Experts, i am trying a GET request to my server with some extra headers dont know how can i add header here is my code: DefaultHttpClient client = new DefaultHttpClient(); HttpGet method = null; HttpResponse resp = null; method = new HttpGet( new URI(url) ); } catch (Exception e) { e.printStackTrace(); } try { resp = client.execute(method); } catch (IOException e) { e.printStackTrace(); } /// i can add header like below but this shows me POST HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection(); String boundary = "myboundary"; httpConnection.setDoOutput(true); httpConnection.setDoInput(true); httpConnection.setUseCaches(false); //httpConnection.setRequestMethod("GET"); httpConnection.setRequestProperty("Connection","Keep- Alive"); httpConnection.setRequestProperty("Content-Type","multipart/form- data; boundary=" + boundary); httpConnection.setRequestProperty("user-agent",this.user_agent); httpConnection.setRequestProperty("accept- language",this.accept_language); httpConnection.setRequestProperty("user-agent- id",this.user_agent_id); httpConnection.setAllowUserInteraction(true); httpConnection.setInstanceFollowRedirects(true); //httpConnection.connect(); DataOutputStream wr = new DataOutputStream (httpConnection.getOutputStream()); any solution to add header in GET? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] API reference for system application
Hi, I want to do some development on the Android system. Is there a way to make Eclipse know about the entire API that Android provides to systemtools? And is there a reference for that API? Thanks Lutz smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: HttpGet.addHeader
If you use the DefaultHttpClient to connect to your server you don't need to reconnect. You'll receive a HttpResponse. You should validate the status code if the request was successful. after that just retrieve the HttpEntity. This class provides a getContent() method which returns a InputStream: --- snip --- HttpResponse response = null; InputStream in = null; try { client.execute(method); } catch(Exception e) { // handle exception } if(response.getStatusLine().getStatusCode() == 200) { HttpEntity entity = response.getEntity(); if(entity != null) { try { in = entity.getContent(); } catch(IOException e) { // handle exception } } } if(in != null) { // use in to read body of http response } --- snip --- Maybe there is a better way to get the body from the response but I don't know it... Lutz Am 26.03.2009 um 15:43 schrieb zeeshan: thanks for the reply, it is solved actually i was adding header before it get initialised it should be like this method = new HttpGet( new URI(url) ); method.addHeader("Connection","Keep-Alive"); i suppose to get an xml on this request , how can i make input stream? do i need to connect it again like below HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection(); InputStream in = httpConnection.getInputStream(); On Mar 26, 1:15 pm, Stoyan Damov wrote: What happens if you do this instead: method.getParams().setParameter("http.useragent", this.user_agent_id); ? On Thu, Mar 26, 2009 at 2:54 PM, zeeshan wrote: Hi Experts, i am trying to add header on HttpGet but it raise this exception "InvocationTargetException" here is my code: DefaultHttpClient client = new DefaultHttpClient(); HttpGet method = null; HttpResponse resp = null; String url = "http://www.x.com/a.xml";; method.addHeader("Connection","Keep-Alive"); /*method.addHeader("accept-language",this.accept_language); method.addHeader("user-agent-id",this.user_agent_id);*/ method = new HttpGet( new URI(url) ); i also used setHeader but same error please help me out --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Building user interfaces at runtime with layouts from server
The point is now: Android already has this user interface description (layout.xml) and the code which inflates such a description (in preprocessed form) to a user interface. It would be awesome to reuse this code! You can use that LayoutInflater to create the tree of views and attach it to your Activity. I found some code inside the PackageInstaller to load the layout from the resources but you can also use an 'external' xml. --- snip --- View contentView; XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser xpp = factory.newPullParser(); xpp.setInput(new FileReader("/path/to/layout.xml")); LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); contentView = inflater.inflate(xpp, null); setContentView(contentView); --- snip --- This code isn't tested!!! That's only the way I think it should work. Lutz Thanks. Daniel On Mar 23, 6:25 pm, droozen wrote: We might have to know why you want to build this way. There could be other possibilities, including using a much simpler xml that you could parse yourself and add UI elements programmatically. Or have a variety of layouts available that you could set, depending on a value you've downloaded, though I get the feeling you want something more dynamic than that. On Mar 23, 2:10 am,Daniel wrote: Hi all, Q: What is the recommended way to build user interfaces on the device based on layouts provided by a server at runtime? I am aware of this: http://developer.android.com/reference/android/view/ LayoutInflater.html"> For performance reasons, view inflation relies heavily on pre- processing of XML files that is done at build time. Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime; it only works with an XmlPullParser returned from a compiled resource (R.something file.) I could imagine these possibilities: - Parse XML by myself and build the ui tree. (Seems inappropriate to me since there is already maintained code which is able to do this.) - Transform XML on server to a simpler format which is cheaper to parse on the device. (Inappropriate as above.) - Preprocess the XML layout on the server the same way the build does. Transmit it to the client, and then try to load it. But how? android.content.res.XMLBlock is hidden (@hide) and I don't know how to classify the stuff in package com.android.layoutlib.bridge. Any help would be appreciated. Daniel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: HttpGet.addHeader
Am 26.03.2009 um 16:12 schrieb Stoyan Damov: ResponseHandler responseHandler = new BasicResponseHandler(); String body = httpClient.execute(method, responseHandler); That's much simpler. But is there a way to get the status code if you do it this way? Lutz 2009/3/26 Lutz Schönemann : If you use the DefaultHttpClient to connect to your server you don't need to reconnect. You'll receive a HttpResponse. You should validate the status code if the request was successful. after that just retrieve the HttpEntity. This class provides a getContent() method which returns a InputStream: --- snip --- HttpResponse response = null; InputStream in = null; try { client.execute(method); } catch(Exception e) { // handle exception } if(response.getStatusLine().getStatusCode() == 200) { HttpEntity entity = response.getEntity(); if(entity != null) { try { in = entity.getContent(); } catch(IOException e) { // handle exception } } } if(in != null) { // use in to read body of http response } --- snip --- Maybe there is a better way to get the body from the response but I don't know it... Lutz Am 26.03.2009 um 15:43 schrieb zeeshan: thanks for the reply, it is solved actually i was adding header before it get initialised it should be like this method = new HttpGet( new URI(url) ); method.addHeader("Connection","Keep-Alive"); i suppose to get an xml on this request , how can i make input stream? do i need to connect it again like below HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection(); InputStream in = httpConnection.getInputStream(); On Mar 26, 1:15 pm, Stoyan Damov wrote: What happens if you do this instead: method.getParams().setParameter("http.useragent", this.user_agent_id); ? On Thu, Mar 26, 2009 at 2:54 PM, zeeshan wrote: Hi Experts, i am trying to add header on HttpGet but it raise this exception "InvocationTargetException" here is my code: DefaultHttpClient client = new DefaultHttpClient(); HttpGet method = null; HttpResponse resp = null; String url = "http://www.x.com/a.xml";; method.addHeader("Connection","Keep-Alive"); /*method.addHeader("accept-language",this.accept_language); method.addHeader("user-agent-id",this.user_agent_id);*/ method = new HttpGet( new URI(url) ); i also used setHeader but same error please help me out --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Sending Intent to specific Activity
Hi, I want to create a activity that receives intents modify these and send them to an other activity that is also registerd to receive this kind of intents. These two activities are not in the same package. Is there a way to specify a activity that should receive this intent? I am new to android and I know that it would be bad and ugly to do something like this but it is only a proof of concept. Thanks Lutz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Adding padding between buttons in a LinearLayout
Hi, you can try to add a simple View object between the two Buttons. I found this snippet in the Android source code: I haven't tried it so I hope it will work ;-) Lutz Am 26.01.2009 um 17:55 schrieb Inderjeet Singh: > > Hi, > > I am probably missing something totally obvious, but can someone tell > me how to add padding between buttons of a LinearLayout? > > Here is the code fragment from my layout xml file. > xmlns:android="http://schemas.android.com/apk/res/android"; >android:orientation="horizontal" >android:gravity="center" >android:layout_width="fill_parent" >android:layout_height="wrap_content"> > > style="@style/ButtonText" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:paddingLeft="10px" > android:paddingRight="10px" > android:text="First"/> > > style="@style/ButtonText" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:paddingLeft="10px" > android:paddingRight="10px" > android:text="Second"/> > > > The buttons still appear closer together than what I would prefer. How > do I increase the spacing between the "First" and "Second" buttons? > > Thanks > Inder > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Can not access my own service
Hi, my current problem is to access my own service. The thing is I have 2 interfaces for my service and want to restrict one of them to applications that have a special permission. I have a service and an activity in one package. The application has that special permission but I always get a security exception: I've tried the to following things: 1) put the check inside the onBind() method: @Override public IBinder onBind(Intent intent) { if(intent.getAction() != null && intent.getAction().equals(ACTION_SERVICE_MANAGEMENT)) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } // return management binder return mManagementBinder; } if(_DEBUG) Log.d(TAG, "onBind finished"); // call was not local so return public binder return mBinder; } 2) ptu the check inside a method of the binder it self: private IServiceManagement.Stub mManagementBinder = new IServiceManagement.Stub() { public String[] getRoles() throws RemoteException { return PDPService.this.getRoles(); } public void updatePolicy(String policyuri) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } Uri uri = Uri.parse(policyuri); Service.this.updateFile(uri, Service.POLICY_FILE); } } both cases end with a security exception (the one I throw). The result of checkCallingPermission is always -1 (PackageManager.PERMISSION_DENIED). I have doublechecked that the name of the permission in code is the same as the one specified in the manifest file. What am I doing wrong? Thanks for help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How i can pass my String to Another page
You also can put your string into the intents data bundle object if you are using intents to start your next "page": Intent intent = new Intent("YourAction"); intent.setExtras("Username", username); startActivity(intent); Am 28.08.2009 um 12:05 schrieb Panut Sunyakorn: > > You can use SharedPreferences or set static variable for solve this > problem. > > 2009/8/28 ragavendran s : >> >> Hi , >> >> I am new to Android development.I want to transfer transfer my >> String(username) to another page. >> i m having some problems on it...so wil u please tel me the >> answer. >> >> with regards >> S.Raghav >> >>> >> > > > > -- > Panut Sunyakorn > 087-800-3456 > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to call another class method.
you need a reference to the class that contains the method you want to call. To access the mehtod homepage() inside the eSkyGuide from the class Weather, you need an instance of the eSkyGuide class inside the instance of the Weather class. for example: public class Weather extends Activity implements Button.OnClickListener { private eSkyGuide meSkyGuide = new eSkyGuide(); private someMethod() { meSkyGuide.homepage(); } } But you shouldn't do this, because you are trying to set the content view of an activity from inside an other activity. Things like setContentView(), setOnClickListener(), ... should be done once at creation time of an activity: public class eSkyGuide extends Activity implements Button.OnCickListener { public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.homepage); flight_schedule=(Button)findViewById(R.id.fschedule); flight_schedule.setOnClickListener(this); flight_status=(Button)findViewById(R.id.fstatus); flight_status.setOnClickListener(this); weather=(Button)findViewById(R.id.weather); weather.setOnClickListener(this); } } In addition: instead of implementing the OnClickListener interface you can implement an OnClickListener like this: flight_schedule.setOnClickListener(new OnClickListener() { public void onClick(View v) { // put your code here // to call methods of the eSkyGuide class do it like this eSkyGuide.this.methodName(); } }); Am 28.08.2009 um 13:15 schrieb Sasi Kumar: > > > eSkyGuide.java > > public class eSkyGuide extends Activity implements > Button.OnClickListener > { > > public void homepage() >{ > setContentView(R.layout.homepage); > >flight_schedule=(Button)findViewById(R.id.fschedule); >flight_schedule.setOnClickListener(this); > >flight_status=(Button)findViewById(R.id.fstatus); >flight_status.setOnClickListener(this); > >weather=(Button)findViewById(R.id.weather); >weather.setOnClickListener(this); > } > > } > > > weather.java > > public class Weather extends Activity implements > Button.OnClickListener > { > > > // now i want to call here.. thathomepage method. > > > } > > > > > > can any one know about these . > please help in these concepts. > > > Thanks in advance. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How i can pass my String to Another page
Am 28.08.2009 um 13:42 schrieb Sasi Kumar: > > public static String username; > > > s2.java > > private String df; > > df=s1.username; Bad idea. So you have to hardcode the username because it's static and you can't change it at runtime Use intents for this > > thats all!. > > On Aug 28, 2:22 pm, ragavendran s wrote: >> Hi , >> >> I am new to Android development.I want to transfer transfer my >> String(username) to another page. >> i m having some problems on it...so wil u please tel me the >> answer. >> >> with regards >> S.Raghav > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Expose service interface to other application
Hi, I have created a service and want to expose the interface to other applications. For one service I have done this successfuly. I just put the AIDL interface into the new project and all worked fine. Now for this service I've done the same but I get a java.lang.VerifyError when trying to use this interface. I think that the problem is that the AIDL uses a class (PolicyRole) that is only defined in the source code of the service. To compile the source that uses the interface I had to link against the code of the service but at runtime the error appears. The AIDL for the interface I want to use --- 8< --- 8< --- 8< --- package de. [...] . [...] .softwarepolicy.pep; import de. [...] . [...] .softwarepolicy.pep.roles.PolicyRole; interface IPEPServiceManagement { List getAvailableRoles(in int type); void setRoles(inout String[] roles); List getActiveRoles(in int type); void updateRoles(String uri); void reloadRoles(); } --- 8< --- 8< --- 8< --- the AIDL for the class PolicyRole that is used in the previous AIDL --- 8< --- 8< --- 8< --- package de.fraunhofer.sit.softwarepolicy.pep.roles; parcelable PolicyRole; --- 8< --- 8< --- 8< --- The code for the class PolicyRole is only inside the services project so I added the service to the build path and the compile doesn't complain.. can someone give me a hint how to expose a service the right way? Thanks smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Can not access my own service
I've tested it with a system permission (android.permission.INTERNET) and it worked fine. But what is wrong with the permission definition : --- 8< --- 8< --- 8< --- android:description="@string/pdpmanagement_permission_description">permission> --- 8< --- 8< --- 8< --- The three dots are not in the definition. parts of the right URL are just replaced. Am 28.08.2009 um 17:35 schrieb Roman ( T-Mobile USA): Only for testing purpose, instead of using your own created permission, use an already defined system permission and check whether your code works fine. If yes, you know that there are some problems with how you define and expose your own permission. -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 28, 3:29 am, Lutz Schönemann wrote: Hi, my current problem is to access my own service. The thing is I have 2 interfaces for my service and want to restrict one of them to applications that have a special permission. I have a service and an activity in one package. The application has that special permission but I always get a security exception: I've tried the to following things: 1) put the check inside the onBind() method: @Override public IBinder onBind(Intent intent) { if(intent.getAction() != null && intent.getAction().equals(ACTION_SERVICE_MANAGEMENT)) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } // return management binder return mManagementBinder; } if(_DEBUG) Log.d(TAG, "onBind finished"); // call was not local so return public binder return mBinder; } 2) ptu the check inside a method of the binder it self: private IServiceManagement.Stub mManagementBinder = new IServiceManagement.Stub() { public String[] getRoles() throws RemoteException { return PDPService.this.getRoles(); } public void updatePolicy(String policyuri) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } Uri uri = Uri.parse(policyuri); Service.this.updateFile(uri, Service.POLICY_FILE); } } both cases end with a security exception (the one I throw). The result of checkCallingPermission is always -1 (PackageManager.PERMISSION_DENIED). I have doublechecked that the name of the permission in code is the same as the one specified in the manifest file. What am I doing wrong? Thanks for help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Can not access my own service
That is right that the service it self has the tag in the AndroidManifest.xml file. But I don't call checkCallingOrSelfPermission. I call the checkCallingPermission and the result is PERMISSION_DENIED. Normaly I would let android check the permissions but I want to expose more than one interface for that service and each interface should be accessed with different permissions. Am 28.08.2009 um 20:58 schrieb Balwinder Kaur (T-Mobile USA): It seems like if you declare a "uses-permission" in your AndroidManifest.xml file and you call checkCallingOrSelfPermission method, it returns PERMISSION_GRANTED. I would be curious though to know if there is a more elegant way of doing this, or if this is the expected way. Balwinder Kaur Open Source Development Center ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 28, 8:35 am, "Roman ( T-Mobile USA)" wrote: Only for testing purpose, instead of using your own created permission, use an already defined system permission and check whether your code works fine. If yes, you know that there are some problems with how you define and expose your own permission. -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 28, 3:29 am, Lutz Schönemann wrote: Hi, my current problem is to access my own service. The thing is I have 2 interfaces for my service and want to restrict one of them to applications that have a special permission. I have a service and an activity in one package. The application has that special permission but I always get a security exception: I've tried the to following things: 1) put the check inside the onBind() method: @Override public IBinder onBind(Intent intent) { if(intent.getAction() != null && intent.getAction().equals(ACTION_SERVICE_MANAGEMENT)) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } // return management binder return mManagementBinder; } if(_DEBUG) Log.d(TAG, "onBind finished"); // call was not local so return public binder return mBinder; } 2) ptu the check inside a method of the binder it self: private IServiceManagement.Stub mManagementBinder = new IServiceManagement.Stub() { public String[] getRoles() throws RemoteException { return PDPService.this.getRoles(); } public void updatePolicy(String policyuri) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } Uri uri = Uri.parse(policyuri); Service.this.updateFile(uri, Service.POLICY_FILE); } } both cases end with a security exception (the one I throw). The result of checkCallingPermission is always -1 (PackageManager.PERMISSION_DENIED). I have doublechecked that the name of the permission in code is the same as the one specified in the manifest file. What am I doing wrong? Thanks for help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Can not access my own service
Suddenly it works. The change is, that instead of "hardcode" the permissions name into the code, I used: Manifest.permission.MY_PERMISSIONS_NAME; Am 31.08.2009 um 11:41 schrieb Lutz Schönemann: I've tested it with a system permission (android.permission.INTERNET) and it worked fine. But what is wrong with the permission definition : --- 8< --- 8< --- 8< --- android:description="@string/pdpmanagement_permission_description">permission> --- 8< --- 8< --- 8< --- The three dots are not in the definition. parts of the right URL are just replaced. Am 28.08.2009 um 17:35 schrieb Roman ( T-Mobile USA): Only for testing purpose, instead of using your own created permission, use an already defined system permission and check whether your code works fine. If yes, you know that there are some problems with how you define and expose your own permission. -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 28, 3:29 am, Lutz Schönemann wrote: Hi, my current problem is to access my own service. The thing is I have 2 interfaces for my service and want to restrict one of them to applications that have a special permission. I have a service and an activity in one package. The application has that special permission but I always get a security exception: I've tried the to following things: 1) put the check inside the onBind() method: @Override public IBinder onBind(Intent intent) { if(intent.getAction() != null && intent.getAction().equals(ACTION_SERVICE_MANAGEMENT)) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } // return management binder return mManagementBinder; } if(_DEBUG) Log.d(TAG, "onBind finished"); // call was not local so return public binder return mBinder; } 2) ptu the check inside a method of the binder it self: private IServiceManagement.Stub mManagementBinder = new IServiceManagement.Stub() { public String[] getRoles() throws RemoteException { return PDPService.this.getRoles(); } public void updatePolicy(String policyuri) { // check permission if(checkCallingPermission(PERMISSION_MANAGEMENT) == PackageManager.PERMISSION_DENIED) { Log.d(TAG, "Checked for permission: " + PERMISSION_MANAGEMENT + "\nresult: " + checkCallingPermission(PERMISSION_MANAGEMENT)); throw new SecurityException(); } Uri uri = Uri.parse(policyuri); Service.this.updateFile(uri, Service.POLICY_FILE); } } both cases end with a security exception (the one I throw). The result of checkCallingPermission is always -1 (PackageManager.PERMISSION_DENIED). I have doublechecked that the name of the permission in code is the same as the one specified in the manifest file. What am I doing wrong? Thanks for help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~--- smime.p7s Description: S/MIME cryptographic signature
[android-developers] Use classes defined inside other applications
Hi, is it possible to use classes that are defined in other applications? I have two dependent projects and want to use classes from one project inside the other. I use eclipse and in the project preferences > "Project References" I checked the other project. In addition I added the Project/bin-path of the first project to the seconds project libraries. Both apps are installed on a device but I get a VerifyError. How is it possible to use classes from an other application? I don't want to copy the code into the second project! Thanks for help smime.p7s Description: S/MIME cryptographic signature
[android-developers] Re: Use classes defined inside other applications
I managed it by creating a new Java-Project set the "Project Reference" to that project and also added that project to the "Java Build Path". Is that identical to creating a jar file and specify it in the manifest file? Am 31.08.2009 um 14:22 schrieb Alessio Grumiro: > you have to create a jar file and import jar library in other projects > > 2009/8/31 Lutz Schönemann > Hi, > > is it possible to use classes that are defined in other applications? > > I have two dependent projects and want to use classes from one > project inside the other. I use eclipse and in the project > preferences > "Project References" I checked the other project. In > addition I added the Project/bin-path of the first project to the > seconds project libraries. Both apps are installed on a device but I > get a VerifyError. How is it possible to use classes from an other > application? I don't want to copy the code into the second project! > > Thanks for help > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Don't receive intent
Hi, my current problem is that I don't receive an intent. I have a BroadcastReceiver and defined in the AndroidManifest.xml file that it also should receive intents with these actions - "android.intent.action.PACKAGE_ADDED" - "android.intent.action.PACKAGE_CHANGED" - "android.intent.action.PACKAGE_REMOVED" - "android.intent.action.PACKAGE_REPLACED" Do I need a permission to receive this broadcasts? Here is a snippet from my AndroidManifest.xml --- 8< --- 8< --- 8< --- --- 8< --- 8< --- 8< --- thanks for help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Don't receive intent
Okay, found the missing line in my AndroidManifest.xml file by digging deep inside the android code ;-) To receive these intents you have to set also the data scheme. The filter should look like this: Am 01.09.2009 um 15:13 schrieb Lutz Schönemann: > > Hi, my current problem is that I don't receive an intent. I have a > BroadcastReceiver and defined in the AndroidManifest.xml file that it > also should receive intents with these actions > > - "android.intent.action.PACKAGE_ADDED" > - "android.intent.action.PACKAGE_CHANGED" > - "android.intent.action.PACKAGE_REMOVED" > - "android.intent.action.PACKAGE_REPLACED" > > Do I need a permission to receive this broadcasts? Here is a snippet > from my AndroidManifest.xml > > > --- 8< --- 8< --- 8< --- > > android:enabled="true"> > >action> >android:name="android.intent.action.PACKAGE_ADDED"> >action> >action> >action> > > > > --- 8< --- 8< --- 8< --- > > > thanks for help > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Get certificate used to sign an application
I need some info about the android.content.pm.Signature object. Currently I do the following to get the certificate used to sign the package: ---8<---8<---8<--- ByteArrayInputStream is; CertificateFactory cf; try { cf = CertificateFactory.getInstance("X.509"); } catch(CertificateException e) { tv.setText("Cannot create CertificateFactory instance:\n" + e.getMessage()); return; } Certificate cert; is = new ByteArrayInputStream(sigs[0].toByteArray()); try { cert = cf.generateCertificate(is); } catch(CertificateException e) { text += "Cannot generate certificate from input stream:\n" + e.getMessage() + "\n"; continue; } --->8--->8--->8--- Is that the correct way to do this? I don't know what additional information are stored in the Signatrue object and if this additional information can affect the creation of the Certificate instance. I think the object containes the signed hashes of the Package but how can I retrieve and check these? In addition how can I get information about the type of certificate used ("x509", PGP, ...) Thanks for help Lutz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Installation error: failure -12
Maybe you have compiled your application for Android 1.5. Make sure to set Android 1.1 as target. Am 13.07.2009 um 13:10 schrieb bluestar: > > Hi all, > >I used Eclipse-SDK1.5 to create one app from apk(myClient.apk), >and install on OpenMoko(Android version 1.0) >but i received this error: >pkg: /data/local/tmp/myClient.apk >Failure [-12] > >My apk can install successfully on Android-Emulator under WinXP. > >Anyone could help me, explaining how to install an apps? > >Thanks for your big help. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Getting all views of an activity.
If you have all your Views in a LinearLayout or an other container that extends ViewGroup you can use the functions getChildCount() and getChildAt(int) and iterate through all of the contained views. Am 13.07.2009 um 18:21 schrieb Mathieu Plourde: > > I have the instance to my activity, and I want to get all the views > that are in this activity. I need to add a listener to each view, for > any activity. That means I can't user findViewById. Is there any way > to do this? I was hoping for a activity.getViews() or something, but > it doesn't exist. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Starting service in separate thread
Hi, i have a little frontend showing a list of items that it will retrieve from a service. I want that service to be started in a separate thread so the UI is still responding to user interaction while waiting for that service to call a callback method. What is the best way to start the service in a detached thread? My current solution is: new Thread() { @Override public void run() { // start Service Intent intent = new Intent("MyServiceAction"); try { startService(intent); } catch(Exception e) { Log.e(TAG, "Unable to start Service: " + e.getMessage()); } } }.start(); It seems that the service is still in the same thread as my UI. The debugger doesn't show an additional thread. What am I doing wrong? Thanks for help Lutz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Starting service in separate thread
How should I design a method that needs a few seconds to return a result? Even if I put the call to that method inside a separate thread it will not return faster. Am 27.07.2009 um 16:07 schrieb Mark Murphy: > > Lutz Schönemann wrote: >> Hi, >> >> i have a little frontend showing a list of items that it will >> retrieve >> from a service. I want that service to be started in a separate >> thread >> so the UI is still responding to user interaction while waiting for >> that service to call a callback method. >> >> What is the best way to start the service in a detached thread? My >> current solution is: >> >> new Thread() { >> @Override >> public void run() { >> // start Service >> Intent intent = new Intent("MyServiceAction"); >> try { >> startService(intent); >> } >> catch(Exception e) { >> Log.e(TAG, "Unable to start Service: " + >> e.getMessage()); >> } >> } >> }.start(); >> >> It seems that the service is still in the same thread as my UI. The >> debugger doesn't show an additional thread. What am I doing wrong? > > You don't want the service to be started in a background thread, > because > there is no such concept. All Android components share a common > primary > ("UI") thread. > > Instead, have the service start its own background thread and do its > work there. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Need help for your Android OSS project? http://wiki.andmob.org/hado > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Starting service in separate thread
So, do you think that it is a good idea to design the UI that it wait's for callbacks from the service? Am 27.07.2009 um 16:44 schrieb Mark Murphy: > > Lutz Schönemann wrote: >> How should I design a method that needs a few seconds to return a >> result? Even if I put the call to that method inside a separate >> thread >> it will not return faster. > > That is difficult for me to answer in the abstract. > > The goal behind the separate thread is so you can release the UI > thread > back to Android, so it can render your GUI and such. It may not take > any > less time, but time on background threads is more flexible than time > on > the UI thread. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Need help for your Android OSS project? http://wiki.andmob.org/hado > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] LocationManager and PendingIntent problem
Hi, I have more than one problem to use the addProximityAlert() method from the LocationManager class. The first thing is that I want to create a PendingIntent for a broadcast receiver. Therefor I use this code: Intent intent = new Intent("app1.PROXIMITY_ALERT"); PendingIntent pintent = PendingIntent.getBroadcast(Activity1.this, 1, intent, 0); The problem is, that I get this error message: "No activity found to handle intent { action=app1.PROXIMITY_ALERT }" I'm confused because this should not call an Activity but a BroadcastReceiver. If I send this intent as a broadcast my self, the BroadcastReceiver receives this intent... What is wrong with my code? I tried to create an intent to call an Activity instead and registered it to be send when reaching a location: Intent intent = new Intent(Intent.ACTION_DEFAULT) intent.setType("vnd.app1/activity1"); PendingIntent pintent = PendingIntent.getBroadcast(Activity1.this, 1, intent, 0); LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); lm.addProximityAlert(latitude, longitude, radius, -1, pintent); The problem is that the Activity is called immediately but NEVER if the registered location is reached. I'm working on a emulator and setting the gps coordinates using the geo fix command. Can anyone help me with this problems thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: LocationManager and PendingIntent problem
I have created a new project focusing on that problem. Now the PendingIntent.getBroadcast() method doesn't try to start an activity any longer. But the problem that the LocationManager doesn't fire the intent still consists. I have a Activity that creates a PendingIntent and calls the addProximityAlert() method. The BroadcastReceiver should only log the incomming events. The only event that appears is the broadcast I send by my self (sendBroadcast(intent);) public class MyActivity extends Activity { private static final String PROXIMITY_ALERT = "de.pengingintent.Activity.PROXIMITY_ALERT"; private static final String TAG = "MyActivity"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent = new Intent(PROXIMITY_ALERT); PendingIntent pintent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0); // just to test if the broadcast receiver exists Log.d(TAG, "testing broadcast receiver"); sendBroadcast(intent); LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); lm.addProximityAlert(1, 1, 200, 2, pintent); } } public class MyReceiver extends BroadcastReceiver { private static final String TAG = "MyReceiver"; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Log.d(TAG, "received new intent"); if(intent.getAction() != null) Log.d(TAG, intent.getAction()); Bundle extras = intent.getExtras(); if(extras != null) { if(extras.containsKey(LocationManager.KEY_PROXIMITY_ENTERING)) { Log.d(TAG, LocationManager.KEY_PROXIMITY_ENTERING + " is: " + Boolean .toString(extras.getBoolean(LocationManager.KEY_PROXIMITY_ENTERING))); } } } } The latitude and longitute I registerd for is 1, 1 and on the terminal I run the "geo" command multiple times: geo fix 3 3 geo fix 1 1 ... What am I doing wrong? Am 03.08.2009 um 15:12 schrieb Lutz Schönemann: > > Hi, > > I have more than one problem to use the addProximityAlert() method > from the LocationManager class. > > The first thing is that I want to create a PendingIntent for a > broadcast receiver. Therefor I use this code: > > Intent intent = new Intent("app1.PROXIMITY_ALERT"); > PendingIntent pintent = PendingIntent.getBroadcast(Activity1.this, 1, > intent, 0); > > The problem is, that I get this error message: > > "No activity found to handle intent { action=app1.PROXIMITY_ALERT }" > > I'm confused because this should not call an Activity but a > BroadcastReceiver. > If I send this intent as a broadcast my self, the BroadcastReceiver > receives this intent... > > What is wrong with my code? > > > I tried to create an intent to call an Activity instead and registered > it to be send when reaching a location: > > Intent intent = new Intent(Intent.ACTION_DEFAULT) > intent.setType("vnd.app1/activity1"); > > PendingIntent pintent = PendingIntent.getBroadcast(Activity1.this, 1, > intent, 0); > > LocationManager lm = > (LocationManager)getSystemService(Context.LOCATION_SERVICE); > lm.addProximityAlert(latitude, longitude, radius, -1, pintent); > > The problem is that the Activity is called immediately but NEVER if > the registered location is reached. > > > I'm working on a emulator and setting the gps coordinates using the > geo fix > command. > > > Can anyone help me with this problems > thanks > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: LocationManager and PendingIntent problem
Okay, I managed to get it to work on a real phone (Google Dev Phone 1). But why doesn't it work on an emulator? Is there more to do than just use the geo command? Am 03.08.2009 um 19:02 schrieb Dianne Hackborn: > Please look at the examples in ApiDemos. > > 2009/8/3 Lutz Schönemann > > I have created a new project focusing on that problem. > Now the PendingIntent.getBroadcast() method doesn't try to start an > activity any longer. > > But the problem that the LocationManager doesn't fire the intent still > consists. I have a Activity that creates a PendingIntent and calls the > addProximityAlert() method. The BroadcastReceiver should only log the > incomming events. The only event that appears is the broadcast I send > by my self (sendBroadcast(intent);) > > public class MyActivity extends Activity { > >private static final String PROXIMITY_ALERT = > "de.pengingintent.Activity.PROXIMITY_ALERT"; >private static final String TAG = "MyActivity"; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > Intent intent = new Intent(PROXIMITY_ALERT); > PendingIntent pintent = > PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0); > >// just to test if the broadcast receiver exists > Log.d(TAG, "testing broadcast receiver"); > sendBroadcast(intent); > > LocationManager lm = > (LocationManager)getSystemService(Context.LOCATION_SERVICE); > lm.addProximityAlert(1, 1, 200, 2, pintent); > } > > } > > public class MyReceiver extends BroadcastReceiver { > >private static final String TAG = "MyReceiver"; >@Override >public void onReceive(Context context, Intent intent) { >// TODO Auto-generated method stub >Log.d(TAG, "received new intent"); >if(intent.getAction() != null) >Log.d(TAG, intent.getAction()); > >Bundle extras = intent.getExtras(); >if(extras != null) { > > if(extras.containsKey(LocationManager.KEY_PROXIMITY_ENTERING)) { >Log.d(TAG, > LocationManager.KEY_PROXIMITY_ENTERING + " is: " + > Boolean > .toString(extras.getBoolean(LocationManager.KEY_PROXIMITY_ENTERING))); >} > } >} > > } > > > The latitude and longitute I registerd for is 1, 1 and on the terminal > I run the "geo" command multiple times: > > geo fix 3 3 > geo fix 1 1 > ... > > What am I doing wrong? > > > > > Am 03.08.2009 um 15:12 schrieb Lutz Schönemann: > > > > > Hi, > > > > I have more than one problem to use the addProximityAlert() method > > from the LocationManager class. > > > > The first thing is that I want to create a PendingIntent for a > > broadcast receiver. Therefor I use this code: > > > > Intent intent = new Intent("app1.PROXIMITY_ALERT"); > > PendingIntent pintent = > PendingIntent.getBroadcast(Activity1.this, 1, > > intent, 0); > > > > The problem is, that I get this error message: > > > > "No activity found to handle intent { action=app1.PROXIMITY_ALERT }" > > > > I'm confused because this should not call an Activity but a > > BroadcastReceiver. > > If I send this intent as a broadcast my self, the BroadcastReceiver > > receives this intent... > > > > What is wrong with my code? > > > > > > I tried to create an intent to call an Activity instead and > registered > > it to be send when reaching a location: > > > > Intent intent = new Intent(Intent.ACTION_DEFAULT) > > intent.setType("vnd.app1/activity1"); > > > > PendingIntent pintent = > PendingIntent.getBroadcast(Activity1.this, 1, > > intent, 0); > > > > LocationManager lm = > > (LocationManager)getSystemService(Context.LOCATION_SERVICE); > > lm.addProximityAlert(latitude, longitude, radius, -1, > pintent); > > > > The problem is that the Activity is called immediately but NEVER if > > the registered location is reached. > > > > > > I'm working on a emulator and setting the gps coordinates using the > > geo fix > > command. > > > > > > Can anyone help me with this problems > >
[android-developers] understanding the permission-group tag
Hi, I need some help to understand the use of permission-group tag in AndroidManifest files. Is there any need of using permission-group and what benefit offers this grouping? Is there a plus security using it? Does anyone know an example when to use it? Thanks for help Lutz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: understanding the permission-group tag
Doesn't anybody know something about grouping permissions? The documentation does not explain that tag in depth. Lutz Am 14.05.2009 um 16:38 schrieb Lutz Schönemann: > > Hi, > > I need some help to understand the use of permission-group tag in > AndroidManifest files. Is there any need of using permission-group and > what benefit offers this grouping? Is there a plus security using it? > Does anyone know an example when to use it? > > Thanks for help > Lutz > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---