[android-developers] enabling lock-screen

2014-01-29 Thread dashman

My app enables lock-screen.

Have all the device-admin privs etc.

When i enable it - i just get the slider - not the password prompt.


 devicePolicyManager.setPasswordQuality(
componentName,
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED );

devicePolicyManager.setPasswordMinimumLength(componentName, 4);

 boolean result = devicePolicyManager.resetPassword("1234", 
DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);

Log.i( TAG, "enable-lock result=" + result);

result is good.




-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] recover key store password from Android Studio saved preferences? Or, change gradle build to build APK as release?

2014-01-29 Thread xrd
Android Studio recently updated itself and now builds my APK with debugging 
symbols, and Google Play rejects the APK when I upload it.

I also recently moved, so the paperwork with my saved key store password is 
buried somewhere. 

Is there a way to retrieve the saved keystore password and key password 
from Android Studio preferences? I have tried grepping through files in 
~/Library/Preferences/ as well as dumping all the plists but don't see 
anything matching the password.

Is there a way to dump the command line output of the gradle command run 
via Android Studio as I assume it is provided to gradle, right?

Any other creative ways to do this? Please save me from digging through all 
the junk piled up in my basement, I might die in an avalanche...

Chris

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Re: enabling lock-screen

2014-01-29 Thread dashman
my bad on this...I was pressing the power button to lock the screen for
testing - and in phone settings - it wasn't enabled.

so the lock feature seems to be working.


now the opposite problem - i'm also trying to unlock the screen
programmatically.

 devicePolicyManager.setPasswordMinimumLength( componentName, 0 );

boolean result = devicePolicyManager.resetPassword( "", 
DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY );

but after a locking the screen - i  try to unlock and a slide-to-unlock 
prompt opens
up. shouldn't it go straight to the last screen - i.e. no slide-to-unlock 
prompt.









On Wednesday, January 29, 2014 10:47:15 AM UTC-5, dashman wrote:
>
>
> My app enables lock-screen.
>
> Have all the device-admin privs etc.
>
> When i enable it - i just get the slider - not the password prompt.
>
>
>  devicePolicyManager.setPasswordQuality(
> componentName,
> DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED );
>
> devicePolicyManager.setPasswordMinimumLength(componentName, 4);
>
>  boolean result = devicePolicyManager.resetPassword("1234", 
> DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);
>
> Log.i( TAG, "enable-lock result=" + result);
>
> result is good.
>
>
>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [android-developers] DialogFragment created twice after orientation change

2014-01-29 Thread TreKing
You are creating a new Dialog in your onCreate method. onCreate gets called
both the first time the app is run (with savedInstanceState set to null)
and after an orientation (configuration) change, with savedInstanceState
set to the last saved state Bundle.

In the latter case, the system also automatically re-creates the original
dialog fragment as part of the lifecycle. Therefore, the system is
recreating the dialog for you and you are additionally creating a new
instance.

You explicitly check if the dialog already exists in the fragment manager,
which would be the original instance with the text before orientation
change, and you replace it with the new instance, which would be brand new
and not have the text saved from the original.

The simple solution here is to remove checking if the dialog already exists
and just only create the dialog if savedInstanceState is null.


On Tue, Jan 28, 2014 at 1:52 PM, Daniel Rindt wrote:

> Dear readers,
>
> i experienced a double call to onCreateDialog also to onCreateView in my
> project.
> here is my activity code:
> public class DialogTestActivity extends Activity {
>
> @Override
> protected void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> AskForNameDialog d = AskForNameDialog.newInstance(new
> OnNameSetListener() {
>
> @Override
> public void onNameSet(AskForNameDialog dialog, String name) {
> }
>
> }, getString(R.string.enter_manufacturers_name));
>
> this.showMyDialog(d);
> }
>
> private void showMyDialog(DialogFragment d) {
> FragmentTransaction ft = getFragmentManager().beginTransaction();
> Fragment prev = getFragmentManager().findFragmentByTag("dialog");
> if (prev != null) {
> ft.remove(prev);
> }
> ft.addToBackStack(null);
> d.show(ft, "dialog");
> }
>
> }
>
> here is the dialog:
> public class AskForNameDialog extends DialogFragment {
>
> protected static final String TAG =
> AskForNameDialog.class.getSimpleName();
>
> private OnNameSetListener mCallback;
> private String mMessage;
>
> public AskForNameDialog() {
> }
>
> private AskForNameDialog(OnNameSetListener listener, String message) {
> mCallback = listener;
> mMessage = message;
> }
>
> public static AskForNameDialog newInstance(OnNameSetListener listener,
> String message) {
> AskForNameDialog f = new AskForNameDialog(listener, message);
> Bundle b = new Bundle();
> b.putBoolean("blah", false);
> f.setArguments(b);
> return f;
> }
>
> @Override
> public Dialog onCreateDialog(Bundle savedInstanceState) {
> int padd = convertDpToPixel(20, getActivity());
> final EditText txt = new EditText(getActivity());
> txt.setSingleLine();
>
> final AlertDialog ad = new AlertDialog.Builder(getActivity())
> .setTitle(mMessage)
> .setPositiveButton(android.R.string.ok, null)
> .create();
> ad.setView(txt, padd, padd, padd, padd);
>
> ad.setOnShowListener(new DialogInterface.OnShowListener() {
>
> @Override
> public void onShow(DialogInterface dialog) {
>
> Button b = ad.getButton(AlertDialog.BUTTON_POSITIVE);
> b.setOnClickListener(new OnClickListener() {
>
> @Override
> public void onClick(View v) {
> if (!FormUtils.isValid(txt, 3, 50,
> R.string.input_error_min_max_letters))
> return;
>
> mCallback.onNameSet(AskForNameDialog.this,
> txt.getText().toString());
> dismiss();
> }
> });
> }
> });
>
> return ad;
> }
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> // setCancelable(false);
> }
>
> public static int convertDpToPixel(float dp, Context context) {
> Resources resources = context.getResources();
> DisplayMetrics metrics = resources.getDisplayMetrics();
> return (int) (dp * (metrics.densityDpi / 160));
> }
>
> public interface OnNameSetListener {
>
> public void onNameSet(AskForNameDialog dialog, String name);
>
> }
>
> }
>
> I'm using exactly the same code in another project and there the dialog is
> working well.
> Explaining what happened:
>
>1. Dialog properly appears with the input field
>2. enter some letters in the EditText view
>3. do an orientation change
>4. the dialog appear but without the previous entered text
>
> In the debugger i put a breakpoint on onCreateDialog() and see that it
> called first containing savedInstanceState with data
> and immediately after the the method is called again with
> savedInstanceS

Re: [android-developers] DialogFragment created twice after orientation change

2014-01-29 Thread Daniel Rindt
Am Donnerstag, 30. Januar 2014 00:01:56 UTC+1 schrieb TreKing:
>
> You are creating a new Dialog in your onCreate method. onCreate gets 
> called both the first time the app is run (with savedInstanceState set to 
> null) and after an orientation (configuration) change, with 
> savedInstanceState set to the last saved state Bundle.
>
> In the latter case, the system also automatically re-creates the original 
> dialog fragment as part of the lifecycle. Therefore, the system is 
> recreating the dialog for you and you are additionally creating a new 
> instance.
>
> You explicitly check if the dialog already exists in the fragment manager, 
> which would be the original instance with the text before orientation 
> change, and you replace it with the new instance, which would be brand new 
> and not have the text saved from the original.
>
> The simple solution here is to remove checking if the dialog already 
> exists and just only create the dialog if savedInstanceState is null.
>

Thanks for your message and efforts with my problem. I am really thankful 
for that.
I've in this example neglect that onCreate() behave as you mentioned. I've 
adjusted to code and shows like this just for testing:

public class DialogTestActivity extends Activity implements OnClickListener 
{

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dialog_test);
((Button) findViewById(R.id.button1)).setOnClickListener(this);
}

@Override
public void onClick(View v) {
AskForNameDialog d = AskForNameDialog.newInstance(new 
OnNameSetListener() {

@Override
public void onNameSet(AskForNameDialog dialog, String name) {
}

}, getString(R.string.enter_manufacturers_name));
d.show(getFragmentManager(), "dialog");
}

}
 
added a simple button (layout omitted here just linear with a button) and 
this should open the dialog. It behaves exactly in the same manner as 
already mentioned.
I have tried really all the stuff i found belonging to my problem, read the 
android developer blog about this, and all this really not solve this.

Thank you for your help
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] NFC host card emulator

2014-01-29 Thread F4L|{0
HI

I have some problem to emulate card with android 4.4. 
has someone some example  for learn to use this functionality?

I read this article 
http://developer.android.com/guide/topics/connectivity/nfc/hce.html#, but I 
don't understand how HCE work exactly. if the HCE create a secure area or 
no. if yes how manage this.

thanks for support

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [android-developers] Abridged summary of android-developers@googlegroups.com - 8 Messages in 5 Topics

2014-01-29 Thread Ruplekha Verma
Kindly delete my all discussion made in your group.

*Ruplekha Verma*


On Tue, Jan 28, 2014 at 11:45 AM, wrote:

>   Today's Topic Summary
>
> Group: http://groups.google.com/group/android-developers/topics
>
>- Is it possible to split only some items into the bottom with split
>ActionBar? <#143d78296d780f97_group_thread_0> [1 Update]
>- Android Studio does not see compile dependencies added in
>project.afterEvaluate <#143d78296d780f97_group_thread_1> [1 Update]
>- Scrolling framelayout in TabHost <#143d78296d780f97_group_thread_2>[2 
> Updates]
>- how to Check mobile data on/off in the device 
> settings.<#143d78296d780f97_group_thread_3>[3 Updates]
>- Scrollable COntent <#143d78296d780f97_group_thread_4> [1 Update]
>
>   Is it possible to split only some items into the bottom with split
> ActionBar?
>
>Xi Shen  Jan 28 09:39AM +0800
>
>when using google, i only check the first 2 hits...damn google...lol
>
>thanks man xD
>
>
>
>--
>Regards,
>David Shen
>
>http://about.me/davidshen
>https://twitter.com/#!/davidshen84
>
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>   Android Studio does not see compile dependencies added in
> project.afterEvaluate
>
>Alexander Osmanov  Jan 27 03:31PM -0800
>
>Hi,
>
>I am writing a Gradle plugin that would add compile dependencies based
>on
>values I declare in extension. More specifically in extension I
>declare a
>version of a lib I want to be added. 
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>   Scrolling framelayout in 
> TabHost
>
>Rahul Kaushik  Jan 27 06:28PM +0530
>
>i am creating tabhost dynamically i want all the tabs to be fixed and
>framelayout tob scrolling
>Please suggest
>
>Thanks
>RK
>
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>
>TreKing  Jan 27 03:09PM -0600
>
>
>> i am creating tabhost dynamically i want all the tabs to be fixed and
>> framelayout tob scrolling
>> Please suggest
>
>Please explain your problem in more detail.
>
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>   how to Check mobile data on/off in the device 
> settings.
>
>12169  Jan 27 01:06AM -0800
>
>Hi,
>
>is there any way to check ,mobile data on/off in the settings.
>
>On Sunday, January 26, 2014 11:22:19 PM UTC+5:30, 12169 wrote:
>
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>
>lbendlin  Jan 27 04:22AM -0800
>
>What do you actually need to accomplish? Normally you would try to
>reach a
>well known host like 8.8.8.8 and if that succeeds you're connected (on
>whatever network connection).
>
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>
>12169  Jan 27 08:41AM -0800
>
>Hi,
>
>I just want to check ,mobile data on/off in the device settings.
>
>On Sunday, January 26, 2014 9:52:19 AM UTC-8, 12169 wrote:
>
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>   Scrollable 
> COntent
>
>Rahul Kaushik  Jan 27 04:42PM +0530
>
>I am dynamically creating tabs and there contant but i am not to able
>scroll the cotent of tabs pls sugges below is my code
>
>TabHost tabHost ;
>TabSpec ts1 = tabHost.newTabSpec(value); 
> ...more
>
>Back to top <#143d78296d780f97_digest_top>
>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups

Re: [android-developers] NFC host card emulator

2014-01-29 Thread Nikolay Elenkov
On Thu, Jan 30, 2014 at 4:50 PM, F4L|{0  wrote:
> HI
>
> I have some problem to emulate card with android 4.4.
> has someone some example  for learn to use this functionality?
>
> I read this article
> http://developer.android.com/guide/topics/connectivity/nfc/hce.html#, but I
> don't understand how HCE work exactly. if the HCE create a secure area or
> no. if yes how manage this.
>

There is nothing secure about HCE itself. Unlike with real smartcards or
the embedded secure element (SE) element found in some Android
devices all processing is done inside of a regular Android app. As such,
it is subject to the same attacks. For example, if you have root access
you can dump the memory of the app that implements HCE and obtain
whatever information it is processing (cryptographic keys, credit card numbers,
etc.) If you need to store stuff you use with HCE securely, you need to
implement your own security. You can use password based encryption,
the device keystore service, or offload all sensitive processing to a
server.

Here's an example that uses keys stored in the device keystore
to emulate a PKI card:

https://github.com/nelenkov/virtual-pki-card/tree/master/hce-pki

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.