Sunday, January 10, 2016

Android operating with authority, how to judge whether to refuse or allow.




            


Now mobile phones have brought a lot of rights management, authorization management millet, 360 have, on the phone when the program will prompt you to call so and so, whether to accept.
Will this situation, how to judge whether I have initiated action was rejected or accepted. Otherwise unable to carry out the next step. For example, I want to read contact call history, if it is rejected, I will not get any value, so down may not get the results you want.
Reply:
Using your example to explain that to call pop up a box inside the button has a different response time agree to disagree then hung

Usually you said that there are two cases query the value of one is to judge the success of such File.mkdir returns a true or false is worth another instance of the object is to get that

Look cursor database queries or return values because the contact is probably not much like this, right
Reply:
quote 1 floor shen332401890 reply:
Use your phone that example to explain to pop up a box inside the button has a different response time agree to disagree then hung off

Usually you said that there are two cases query the value of one is to judge the success of such File.mkdir returns a true or false is worth another instance of the object is to get that

Look cursor database queries or return values because the contact is probably not much look like it


Ah, I can understand. But now the problem is to be rejected like everything is normal, the program does not error, continue to go down,
Feeling performed directly tell you execute successful, but where the process does not actually perform. So very confused ah.
Reply:
That may be code logic problem.
Reply:
Stickers next morning under the code you see!
Reply:
quote 4th floor shen332401890 reply:
posted under the code next morning to give you a look!


 
package com.example.contextchecktest;

import android.os.Bundle;
import android.provider.CallLog;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.view.Menu;

public class ContactsCheck extends Activity {

Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_contacts_check);
clearContects (this, "10010");
}

Override
public boolean onCreateOptionsMenu (Menu menu) {
. getMenuInflater () inflate (R.menu.activity_contacts_check, menu);
return true;
}
public void clearContects (Context context, String phoneNum)
{
try {
ContentResolver resolver = context.getContentResolver ();
Cursor cursor = resolver.query (CallLog.Calls.CONTENT_URI, null, "? Number =", new String [] {phoneNum}, null);
while (cursor.moveToNext ()) {
resolver.delete (CallLog.Calls.CONTENT_URI, "? number =", new String [] {phoneNum});
}
} Catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace ();
}
}
}


To delete a contact operation. If there are 360 similar management software on your cell phone, a box will pop up asking you whether to allow the operation is performed. Allow successful, refusal will not succeed, but the program does not have any exceptions.
Reply:
http://developer.android.com/reference/android/content/ContentResolver.html

delete is the return parameters I remember correctly returns -1 indicates a failure like

Cursor determine what getCount ()
Returns the numbers of rows in the cursor

Consider your logic a little less complete it. Personal recommendations
Reply:
quote, 6th Floor shen332401890 reply:
http://developer.android.com/reference/android/content/ContentResolver.html

delete is the return parameters I remember correctly returns -1 indicates a failure like

Cursor determine what getCount ()
Returns the numbers of rows in the cursor

......


Ok. I know what you mean, my question now is getCount rejected return 0, do not enter delete.
But what you said, I tried getColumnCount, refused to return the column number is 1. The time allowed is 26. It seems that the time can be used as the basis to judge.
Reply:
In Cursor cursor = resolver.query sentence on the error, and how to use getCount judge

Reply:
Pro resolve what, I would like to know how do I get my application is to obtain a permission
Reply:
Landlord solved it
How to solve can share with you, I have encountered this problem
Reply:
I encountered the same problem, turn on the camera lights when camera.open Some phones require user authorization, but still refused to return the user a correct object to you, without exception, there is no return code, how can I know the user is allowed or reject it?
Reply:
quote the 11th floor stonecao reply:
I encountered the same problem, turn on the camera lights when camera.open Some phones require user authorization, but the user refused still returns a correct object to you, without exception, there is no return code, how can I know the user is allowed or denied it?


Hello, may I ask you to solve this problem
Reply:
dig a grave.
Reply:
context.checkCallingOrSelfPermission found or not
Reply:
Well this question the old fire
Reply:
android app to get the position, but was refused, and we know how to judge whether the refusal ah, GPS, network positioning have been opened in the

No comments:

Post a Comment